Reputation
1,512
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
7 19
Impact
~24k people reached

  • 0 posts edited
  • 0 helpful flags
  • 169 votes cast
Apr
4
comment Can a programming language by design enforce “clean code”?
What characteristics does "clean code" have for the purposes of this question? You need to define that, otherwise any answer with any justification could be valid.
Mar
18
comment What do language designers do to decide or prove that a particular feature works correctly?
@StevieV I know about lexical analysis, but it's not quite what I'm concerned about here. If I may talk about Rust again, as an example: the ownership system with the rules for immutable and mutable borrows and lifetime annotations is something that has pretty much nothing to do with the syntax of the language, and it's probably not something that requires a complex compiler either. At its core, it's just a very clever set of rules and my question is how did they fully prove that this clever set of rules would do its job before they said "now let's put all of that in the compiler"?
Mar
18
comment What do language designers do to decide or prove that a particular feature works correctly?
@StevieV I mean a person who decides what goes into a language and what's left out, what the semantics of various operations are, what promises are made to the user of the language, and so on. That person may or may not be involved in the construction of the compiler (though I personally would usually expect them to at least be involved and even be able to create a prototype compiler, but it's all optional).
Mar
8
comment Is it possible to statically predict when to deallocate memory---from source code only?
This isn't possible to do in the general case. Rust takes an interesting path though, because it forbids a lot of things that are legal in other languages (e.g. C, C++, C#, Java) and it appends more compile-time information (e.g. lifetimes as generic arguments). By doing these, instead of having to solve the lifetime problem for the general case, Rust forces you to express everything through a few specific special cases that have well known incoming and outgoing requirements to the compiler. (Which I think is a good direction for languages that want no tracing GC and no dangling pointers.)
Feb
18
comment Should I throw an exception in case of a meaningful value outside of the range or handle it myself?
@supercat I tend to agree with you, but since I don't know which values are actually invalid in the Web Mercator specification, I'm trying not to draw any hard conclusions. The OP knows the problem domain better than I do.
Jan
31
comment Help in understanding computer science, programming and abstraction
@recursivePointer I've made some edits to expand on that.
Oct
1
comment Should I stop using the term C/C++?
It's true that C and C++ share a common subset. But then, again, so do C and C#, C++ and C#, C and Java, and so on.
Sep
15
comment Is a memory of all possible permutations of a kilobyte block and pointers possible?
So, in a way, we're already using this system - but we're doing it with lazy evaluation of the kilobyte-sized bit patterns, which allows us to save tons of storage space!
Mar
20
comment What is the effectiveness of code reviewing by just reading?
@gnat I've done it successfully multiple times with other peoples' code. The sources of many kinds of bugs have some telltale patterns. Nobody said that this is the "typical debugging process", but it still is entirely possible and useful if you can't run it, for any reason.
Mar
4
comment Team member questioning moving from VBA to C#
An added advantage of VB.NET is that you can pretty easily combine components written in different .NET languages. So, you can (for example) migrate from VBA to VB.NET and then add new functionality in C#, VB.NET or anything else that makes sense for your project.
Jan
31
comment Finding a Pre-Written Software License
People warn against the Creative Commons license as a software license because it doesn't spell out the exact freedoms that make FOSS what it is. However, your software is not FOSS. Therefore, a CC license may not be as unsuitable as you may think.
Jan
9
comment Explain MVC to non-programmers
If I had to describe it in simplified terms, I would describe it as an architecture pattern that focuses on separation of concerns - this, in turn, allows frontend developers to focus on the frontend, backend developers to focus on the backend and database developers to focus on the database, without bothering each other as much as they would in a differently structured system.
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
@delnan It's true I'm mostly interested in languages that abstract away the storage details, but please feel free to include anything you think is relevant, even if it's not applicable in those languages.
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
When talking about escape analysis, I also meant allocating to automatic storage (it doesn't solve everything, but as you say, it solves some things). I also admit I had underestimated the extent to which fields and aliasing could make escape analysis fail more often. Cache misses are the thing I was most concerned about when talking about spatial efficiency, so thanks for addressing that.
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
@Telastyn I can see your point, then (although I've found some uses occasionally). By the way, I was also implementing a toy language when I came up with this question. Your answer is useful to me already, but can you include some further practical caveats that you met, if any? Also, can you clarify the paragraph about dispatching to/from a CPU instruction?
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
@Telastyn I see your point about the overhead of an additional method call. But I don't think that inlining a call to a function of the base class library is unheard of, or unfeasible (considering that when an instance is created at a local scope or is provided through a variable of a final/sealed type, we can ignore polymorphism and statically link the called functions, even if they are virtual). Also, IMHO variance is useful, even between two types (is the relationship between object and string useless?), plus I'm not necessarily saying that int will inherit dierctly from object
Jan
1
comment What are the caveats of implementing fundamental types (like int) as classes?
int + int can be a regular language-level operator that invokes an intrinsic instruction that's guaranteed to compile to (or behave as) the native CPU integer addition op. The benefit of int inheriting from object isn't only the possibility of inheriting another type from int, but also the possibility of an int behaving as an object without boxing. Consider C# generics: you can have covariance and contravariance, but they are only applicable to class types - struct types are automatically excluded, because they can only become object through (implicit, compiler-generated) boxing.
Dec
24
comment How did OOP evolve to include the notion of Properties
Good answer, it explains the exact practical reasons that led to the introduction of properties as a language-level construct.
Dec
19
comment Is it good practice to inherit from generic types?
I probably misunderstood, then.
Dec
17
comment Is it good practice to inherit from generic types?
Extension methods apply anyway.