Questions involving the design and structure of programming languages.
28
votes
12answers
4k views
Why is 0 false?
This question may sound dumb, but why does 0 evaluates to false and any other [integer] value to true is most of programming languages?
String comparison
Since the question seems a little bit too ...
1
vote
1answer
177 views
How much inconsistency arises from Javascript's high flexibility?
I'll admit it, I haven't yet mastered the language, but my experience with it tells me that Javascript is a highly flexible language, allowing prototypal inheritance, dynamic typing, functions as ...
9
votes
1answer
357 views
How does Go improve productivity with “implicit” interfaces, and how does that compare with C#'s notion of Extension Methods?
In the Go Language Tutorial, they explain how interfaces work:
Go does not have classes. However, you can define methods on struct types. The method receiver appears in its own argument list ...
4
votes
1answer
250 views
Is it possible to write a code without class methods, globals, and class variables? [closed]
I'm designing my own programming language for fun, and I'm thinking of making it fully Object-oriented (no statics, no globals, no class variables, no class methods), so I need to find a way to ...
3
votes
3answers
446 views
Why did Apple choose to design its programming language with future and past tense method names?
There are a lot of methods like this in iOS/Objective C:
- viewDidLoad
- viewWillAppear:
- applicationDidFinishLaunching
I've just been having a discussion with some colleagues about this design ...
18
votes
8answers
2k views
Why is String immutable in Java?
I couldn't understand the reason of it. I always use String class like other developers, but when I modify the value of it, I need to create new instance of String.
What might be the reason of ...
17
votes
4answers
845 views
Why doesn't C# have local scope in case blocks?
I was writing this code:
private static Expression<Func<Binding, bool>> ToExpression(BindingCriterion criterion)
{
switch (criterion.ChangeAction)
{
case ...
31
votes
2answers
1k views
Why do bitwise operators have lower priority than comparisons?
Could someone explain the rationale, why in a bunch of most popular languages (see note below) comparison operators (==, !=, <, >, <=, >=) have higher priority than bitwise operators (&, |, ...
1
vote
2answers
256 views
Why does JavaScript count array lengths by the last index?
JavaScript seems to calculate the array length property by the number of the last index in the array rather than counting the number of items in the array. Example:
var testArray = ['a', 'b', 'c'];
...
2
votes
1answer
137 views
+100
How to make support for bindings for a scripting language
Main
I'm making a scripting language using C++. I plan to use it with a simple test game editor. But I have to make a support for bindings to call game engine's nodes' methods to update positions, ...
1
vote
2answers
164 views
Should I use a formal grammar for my interpreted scripting language
I have a scripting engine I just published as an open source project. It's been sitting on my harddrive waiting for about a year. My engine of course isn't complete in any way, but it does work for ...
1
vote
4answers
615 views
Why many programming languages have only 2 data-structures: arrays and hashes?
Many programming languages have only those 2 structures, and even some languages that have more structures still only provide special syntax for those 2; usually, [] and {}. Why is this? Is there ...
5
votes
2answers
298 views
Alternative Scripting Language to Lua?
I would like to add scripting support to an applications and with plenty scripting languages available I am a bit overwhelmed.
At first I thought about Python but I guess Python is a little too big ...
-3
votes
1answer
152 views
how is developing apps for windows phone 8 is different from windows phone 7.x?
what has changed with regards to the design patterns ? do both use the same development techniques ? if I'm faced with the option of learning windows-phone 7 VS 8 will learning windows phone 7 will ...
11
votes
3answers
361 views
How to implement lazy evaluation of if()
I am currently implementing an expression evaluator (single line expressions, like formulas) based on the following:
the entered expression is tokenized to separate literal booleans, integers, ...
9
votes
4answers
906 views
Is garbage collection needed for implementing safe closures?
I recently attended an online course on programming languages in which, among other concepts, closures were presented. I write down two examples inspired by this course to give some context before ...
7
votes
3answers
556 views
Why there are no compound assignment operators for logical operators (such as ||, && etc)?
According to ECMA-262, part 11.13, following is the exhaustive list of compound assignment operators: *= /= %= += -= <<= >>= >>>= &= ^= |=.
According to the part 11.11, var c ...
9
votes
2answers
602 views
How does C++ handle multiple inheritance with a shared common ancestor?
I'm not a C++ guy, but I'm forced to think about this. Why is multiple inheritance possible in C++, but not in C#? (I know of the diamond problem, but that's not what I'm asking here). How does C++ ...
2
votes
6answers
759 views
Why is an interface in Java not allowed to have state? [closed]
There must be a good reason why Java designers didn't allow any state to be defined in interfaces . Can you please throw some light on this aspect of design decision ?
41
votes
10answers
2k views
I've been told that Exceptions should only be used in exceptional cases. How do I know if my case is exceptional?
My specific case here is that the user can pass in a string into the application, the application parses it and assigns it to structured objects. Sometimes the user may type in something invalid. ...
0
votes
3answers
530 views
Is function overloading in general considered Evil? [closed]
Recently I found about two new programming languages(Vala and google's GO) which don't support method or function overloading and intend on not supporting them in the future ever! The creators of ...
30
votes
4answers
2k views
Why don't languages include implication as a logical operator?
It might be a strange question, but why there is no implication as a logical operator in many languages (Java, C, C++, Python Haskell - although as last one have user defined operators its trivial to ...
2
votes
1answer
51 views
Documentation Generation - FiM++
This is a question I originally asked on Stack Overflow, but as a conceptual design question as opposed to a technical issue, I believe it may be more appropriate, or possibly have alternate parallel ...
-2
votes
1answer
190 views
Teaching English Grammar to a computer/software? [closed]
This Q may seem wierd, but I was stumbling by a thought of how can I teach a Computer a particular human language?? I am planning on a project where in a computer would, like any small human kid, be ...
5
votes
1answer
244 views
Why can't java generics be in arrays?
Why is it that when I try to make an array of ArrayLists: ArrayList<Integer>[] arr=new ArrayList<Integer>[40]; there is an error and java does not allow this?
Is there a reason related to ...
18
votes
9answers
1k views
Are there any programming languages that follow a minimalist development approach?
I find it that when languages are considered the same as commercial software, there is always a constant need to add new features to justify new releases.
Can there be or are there languages where ...
4
votes
3answers
549 views
Why was GOTO included in PHP 5? [closed]
I discovered some time ago that the GOTO control keyword was introduced in PHP 5.3.0.
http://php.net/manual/en/control-structures.goto.php
Why did it happen?
What are the language design goals ...
11
votes
2answers
837 views
Advantages and disadvantages of structuring all code via classes and compiling to classes (like Java)
Edit: my language allows for multiple inheritance, unlike Java.
I've started designing and developing my own programming language for educational, recreational, and potentially useful purposes.
At ...
4
votes
8answers
766 views
Is true multithreading really necessary?
So yeah, I'm creating a programming language. And the language allows multiple threads. But, all threads are synchronized with a global interpreter lock, which means only one thread is allowed to ...
5
votes
1answer
584 views
What's the problem with Scala's XML literals?
In this post, Martin (the language's head honcho) writes:
[XML literals] Seemed a great idea at the
time, now it sticks out like a sore thumb. I believe with the new
string interpolation ...
6
votes
4answers
465 views
Could a programming language work as well without statements?
As programming in JavaScript, I've noticed everything that can be done with statements and blocks can be done with expressions alone. Can a programming language work fine with only expressions? And, ...
3
votes
1answer
189 views
What is a real-world use case of using a Chomsky Type-I (context-sensitive) grammar
I have been having some fun lately exploring the development of language parsers in the context of how they fit into the Chomsky Hierarchy.
What is a good real-world (ie not theoretical) example of a ...
4
votes
10answers
941 views
KISS principle applied to programming language design?
KISS ("keep it simple, stupid" or "keep it simple stupid", see e.g. here) is an important principle in software development, even though it apparently originated in engineering. Citing from the ...
1
vote
2answers
122 views
Requiring multithreading/concurrency for implementation of scripting language
Here's the deal: I'm looking at designing my own scripting/interpreted language for fun. I'm only in the planning stages right now; I want to make sure I have a very strong hold on exactly how I will ...
1
vote
3answers
270 views
Programming language features that help to catch bugs early [closed]
Do you know any programming language features that help to detect bugs early in the software development process - ideally at compile-time or else as early as possible at run-time?
Examples of ...
2
votes
2answers
170 views
Which numeral systems are useful in computer science?
I am wondering which numeral system different programmers are using, or would use if their language has support for them. As an example, in C++ we can use:
Octal by prefixing with 0 (e.g. 0377)
...
38
votes
6answers
2k views
Why do old programming languages continue to be revised?
This question is not, "Why do people still use old programming languages?" I understand that quite well. In fact the two programming languages I know best are C and Scheme, both of which date back to ...
3
votes
1answer
197 views
Why Does F# Contain Both Modules and Namespaces?
I've been assuming that F# includes the module keyword in addition to the namespace keyword due to backwards compatibility with OCaml. Is this the only reason for the inclusion of the module keyword ...
4
votes
2answers
235 views
Simplifying C++11 optimal parameter passing when a copy is needed
It seems to me that in C++11 lots of attention was made to simplify returning values from functions and methods, i.e.: with move semantics it's possible to simply return heavy-to-copy but ...
4
votes
1answer
278 views
Why doesn't Java's BigInteger class have a constructor capable of taking a numeric literal? [closed]
Why doesn't Java's BigInteger class have a constructor capable of taking a numeric literal? Every single time I use BigIntegers, and many times I merely think about them, I wonder this.
What reason ...
1
vote
2answers
161 views
Prioritize compiler functionality/tasks, when designing a new language [closed]
I've already made a very simple compiler with limited functionality. Now I'm getting more on it to make it more like a real-world compiler. I definitely need to start over because I've much more ...
7
votes
5answers
605 views
Language Design: Are languages like Python and CoffeeScript really more comprehensible?
The "Verbally Readable !== Quicker Comprehension" argument on http://ryanflorence.com/2011/case-against-coffeescript/ is really potent and interesting. I and I'm sure others would be very interested ...
1
vote
4answers
479 views
Are programming languages pretty much “stable” for now? [closed]
Recently i have looked at the "timeline" of Programming Languages and while a lot has changed in the past 5-10 years, there are a lot of languages that have pretty much "stayed" the same in their ...
-2
votes
2answers
262 views
Help me select a “Simpler” target to create a new language: .NET, LLVM, Go, Own VM [closed]
Lets define "Simple".
This is my first language. I have no previous experience
I will not dedicate +4 years to learn it properly. I'm a professional software [developer], but as an amateur in this ...
8
votes
3answers
352 views
Why is the rec keyword needed in F#?
In F# it is necessary to use the rec keyword. In Haskell there is no need to explicitly tell if a given function is recursive or not.
Given the role of recursion in functional programming, the F# ...
2
votes
3answers
528 views
Is it easier to write robust code in compiled, strictly-typed languages? [closed]
I'd like to read the opinion of experts on whether compiled, strictly-typed languages help programmers write robust code easier, having their backs, checking for type mismatches, and in general, ...
6
votes
3answers
289 views
Use cases for “private” interfaces?
I was wondering if there was a valid use case for being able to properly define the specific internal properties and functions of a class in a way similar to how an interface defines the public ...
5
votes
2answers
636 views
I want to create a new language [duplicate]
Possible Duplicate:
How do I create my own programming language and a compiler for it
I want to create a new general purpose language that will compile to JavaScript and I'd like to be able ...
9
votes
2answers
1k views
Why null pointer instead of class cast?
In Java:
int count = (Integer) null;
throws a java.lang.NullPointerException.
Why doesn't this throw a Class Cast Exception for ease in programmer understanding?
Why was this exception chosen ...
33
votes
13answers
9k views
How have languages influenced CPU design?
We are often told that the hardware doesn't care what language a program is written in as it only sees the compiled binary code, however this is not the whole truth. For example, consider the humble ...

