Questions involving the design and structure of programming languages.

learn more… | top users | synonyms

2
votes
3answers
371 views

Why is float the default in the majority of languages?

In programming languages, for represent numbers you have (mainly) two types: Int(s) and floats. The us of Int is very easy. However floats cause a lot of unexpected surprises: ...
2
votes
2answers
2k 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
2answers
226 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) ...
2
votes
3answers
277 views

Implementing `let` without using a macro

I'm learning Lisp, and I've just gotten to let, which I don't quite understand (the implementation of). A common definition for it is given in terms of lambda as a macro. However, nowhere have I ...
2
votes
1answer
887 views

What source code organization approach helps improve modularity and API/Implementation separation?

Few languages are as restrictive as Java with file naming standards and project structure. In that language, the file name must match the public class declared in the file, and the file must live in ...
2
votes
1answer
511 views

Reasoning behind the syntax of octal notation in Java?

Java has the following syntax for different bases: int x1 = 0b0101; //binary int x2 = 06; //octal int x3 = 0xff; //hexadecimal Is there any reasoning on why it is 0 instead of something like ...
2
votes
1answer
283 views

Is a partially familiar scripting language desirable?

Given that a program (under development) needs a scripting language, and that for various reasons it's not possible to use an off-the-shelf one as is, I'm considering basing it on the syntax and some ...
2
votes
1answer
227 views

How do you make decorators as powerful as macros?

Quick background: I am designing a Pythonic language that I want to be as powerful as Lisp while remaining easy to use. And by "powerful", I mean "flexible and expressive". I've just been introduced ...
2
votes
1answer
388 views

Is there a name for the 'break n' construct?

In a conversation earlier this week I was discussing certain language features, and I realized I don't have a good word / phrase to describe a particular feature. Some languages, such as PHP, have a ...
2
votes
1answer
73 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
3answers
215 views

Conditional construct for a kleenean data type

I was thinking of an hypothetical programming language with a kleenean data type which would implement Kleene's three-valued logic. To sum up, it's an extension of the boolean data type with the three ...
1
vote
3answers
1k 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 ...
1
vote
3answers
420 views

Why did the Sun engineers decided to make Java only call by value? [closed]

Is there any specific reason they decided to go with Call by value? Is it for simplicity?
1
vote
6answers
872 views

why no hasLock/testLock on mutexes

looking through the docs of posix' pthread_mutex_t and window's mutex and CRITICAL_SECTION I noticed there is no easy way of checking whether the current thread holds a specific mutex posix' ...
1
vote
3answers
385 views

Inc/dec vs +=/-=

I'm looking at a programming language design decision that's difficult to make precisely because there seems to be no objective basis for choosing one option over the other. The question is, given ...
1
vote
2answers
334 views

Should ** bind more tightly than !, ~?

Designing a programming language, I'm including the ** exponentiation operator. In Fortran and Python, the two languages I know of which have this operator, it binds more tightly than unary minus, ...
1
vote
3answers
325 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 ...
1
vote
2answers
161 views

What are/would be the characterists and applications of a programming paradigm where functions can't have statements?

Suppose there is a language where, instead of statements, functions could only be defined in relation to other functions and operators such as partial application and composition. What would be the ...
1
vote
3answers
78 views

Property-level value transformation for indirect object casting

Does any programming language exist to support the explicit, property-level object copy? For example, assume this code: public class Student { public string Name { get; set; } public ...
1
vote
2answers
215 views

What's the reason of choosing PascalCasing over camelCasing or vice versa from a programming language design POV?

I like both but I notice languages that use camelCasing for members sometimes need more adjustments when you want to edit your code. For example (in Python): node.customData() vs ...
1
vote
3answers
195 views

Requiring a specific order of compilaiton

When designing a compiled programming language, is it a bad idea to require a specific order of compilation of separate units, according to their dependencies? To illustrate what I mean, consider C. ...
1
vote
2answers
87 views

What is meant by “redundant, but not duplicative” in the Steelman language requirements?

The Steelman language requirements have this: The language shall require some redundant, but not duplicative, specifications in programs. I think I can see the underlying idea (that re-stating ...
1
vote
9answers
813 views

The New Programming Language & BCL for the Cloud [closed]

Let's say you need to implement a new programming language and BCL designed specifically for operating in the cloud (it won't be used on client machines ever). It should be optimized for cloud ...
1
vote
2answers
157 views

“every statement and declaration an expression that yields a value” why?

At the end of the answer to "Can I do ++x and x++ in Python?" on this page: http://norvig.com/python-iaq.html, you can read: [...] I'm with my fellow Dane, Bjarne Stroustrup, on this one. He said ...
1
vote
2answers
193 views

Why is object-level privacy difficult to use as a paradigm, and why is it desirable?

I have heard a prominent language designer remark that no language today enforces real object privacy, and we are still unsure whether it is possible in practice to design a language that does. ...
1
vote
1answer
155 views

Why is Throwable initCause designed to be called only once?

I find it really odd that the initCause method of Java's Throwable class can only be called once, or even not at all (if the constructor accepting a Throwable was used). This makes exception chaining ...
1
vote
1answer
333 views

Could you blend java and javascript? [closed]

As a developer who spends most of my time in either Java or Javascript these days, I have this fantasy about a language that blends the two of them together. I'm always missing something from one or ...
1
vote
2answers
285 views

Go-like interfaces + multi-methods make sense?

Thinking about the design of a potential new language, I wonder how related are the concepts of built a OO similar to GO interfaces and multi-methods (I get this from ...
1
vote
1answer
200 views

Could it be possible to add the integer type to the ECMAScript standard?

In JavaScript, every number you will ever use will always be represented with what C programmer would call a double. The official type is I believe number. If I recall correctly, that fact was ...
1
vote
2answers
324 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
2answers
209 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
0answers
204 views

What is the logic behind the use of different arrows (-> <-) in Haskell?

I've been thinking about language design lately, and reading over some of the new things in Haskell (always a nice source of inspiration). I'm struck by the many odd uses of the left <- and right ...
0
votes
2answers
1k views

Are there any languages that have both high- and low-level facilities? [closed]

Are there any languages that have both high- and low-level facilities? If not, is it feasible to create one? Why or why not? In theory, it would be very helpful to have a programming language that ...
0
votes
2answers
1k views

Why doesn't Ruby have implicit conversion of Fixnum into String?

Ruby normally makes things easy. However, it doesn't allow implicitely converting a number to a string: 2.0.0p247 :010 > "a"+1 TypeError: no implicit conversion of Fixnum into String Why is this ...
0
votes
3answers
401 views

Why do different languages use different Code Line Delimiters? [duplicate]

Possible Duplicate: Why are statements in many programming languages terminated by semicolons? I just found out that R Programming Language, which is somewhat belong to the C family (I'm ...
0
votes
6answers
1k views

Syntax for goto labels

In C, C++ and some dialects of BASIC, goto labels are declared with the syntax label:. I'm working on a language that uses name: type as the syntax for variable declarations, so I'd prefer if possible ...
0
votes
4answers
564 views

Why doesn't the DART language use a special character to identify variables?

I come from a PHP background and I have been considering looking at DART in more detail. DART is an, open source, front-end/back-end, language for web development. PHP has a special $ (dollar) ...
0
votes
3answers
140 views

What is the most robust, extensible way to represent a contract in code? [closed]

I would like to find or create a syntax to express business contracts programmatically, and I am looking for a robust, flexible, future-resistant way to do this. A client should be able to add a ...
0
votes
2answers
278 views

What's the advantage of auto-property initializers without primary constructors?

In this chart about the features that are in or out of the next version of Roslyn (specifically, for C#), primary constructors are out, but auto-property initializers are in. The best use case I've ...
0
votes
2answers
185 views

Benefits of Java in education? [closed]

I hope this isn't too off-topic and/or opinion based. I'm looking for examples and reasons why Java is an acceptable language for education purposes. Here's why: I learned programming on my own in C ...
0
votes
2answers
462 views

Procedure or Event Driven Language For Education [closed]

I am here to ask a question that has been asked many times before. What programming language should I learn to become a intelligent conceptual programmer? Many people agree, you do not have to ...
0
votes
1answer
322 views

Is there any reason zero should still equal false in a new programming language? [duplicate]

I understand that 0 is false because math established that a long time ago and C established it in the programming world, as talked about here. However, other than following established conventions, ...
0
votes
3answers
240 views

Making money from a custom built interpreter? [closed]

I have been making considerable progress lately on building an interpreter. I am building it from NASM assembly code (for the core engine) and C (cl.exe the Microsoft compiler for the parser). I ...
0
votes
2answers
79 views

Storing tokens during lexing stage

I am currently implementing a lexer that breaks XML files up into tokens, I'm considering ways of passing the tokens onto a parser to create a more useful data structure out of said tokens - my ...
0
votes
1answer
112 views

If a variable containing a function gave the function's return instead of a reference to the function, what would an array of functions return? [closed]

I'm creating a prototype scripting language similar to something like Javascript. In my language, every single reference to a variable is actually a function call (a getter function), whether it has ...
0
votes
1answer
130 views

OOP language design attribute symbol [closed]

I am designing a language, and wondering which character (or string) to use to represent that something is an attribute of something else. In all languages I have used, this is done with a dot - ...
0
votes
1answer
62 views

Is automatic conversion to collection types from non-collection variable a good idea? [closed]

Consider public void Do(string[] aBunchOfStrings) { } or public void Do(IReadOnlyList<string> aBunchOfStrings) { } Would it be a bad idea to allow the function call Do("woei"); resolve ...
0
votes
1answer
144 views

Derivations in BNF

I get how to do a derivation of a BNF. My text books do a good job of explaining it (much better than the on-line lecture notes of many profs etc). Example below then my questions: <program> ...
0
votes
1answer
413 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 Windows Phone 8 will learning windows ...
0
votes
0answers
25 views

Rationale behind CSS height with percentage value

I've been using CSS for a few years, but there are some "quirks" that I cannot quite fathom. One of them is the height property when specified with a percentage. To quote the CSS 2.1 Specification ...