Questions about distinctive aspects of particular computer languages, particularly in the way they are written or in the expressive capabilities provided to the programmer.

learn more… | top users | synonyms

2
votes
3answers
269 views

Does a Completely Full-Featured Intermediate Language Exist?

Often when translating between languages (whether with program translation or compiling) it's a one-way, destructive translation. The functionality of the "port" isn't lost, but some of the intent ...
1
vote
1answer
215 views

What aspects of Haskell led to its rise in popularity among experts?

20 years ago, the Functional Programming world was all about Lisp and Scheme. When I went to college in 2001, my Fall Semester Freshman CS 101 course was taught in OCaml. However, these days the ...
-2
votes
4answers
238 views

Why is there no Swap command? [closed]

In many programming languages, I see programmers always struggle to swap 2 variabeles. Most of the time it costs 3 copies and a temporary variabele to accomplish it. Why do programming language dont ...
15
votes
4answers
2k views

Why aren't `void *`'s implicitly cast in C++?

In C, there is no need to cast a void * to any other pointer type, it is always safely promoted. However, in C++, this is not the case. E.g., int *a = malloc(sizeof(int)); works in C, but not in ...
34
votes
2answers
9k views

What are 4th & 5th programming language generations? Are there more of them? [closed]

As it is often classified at school/college level, popular programming languages (C#, Java, C++) are all 3rd generation languages (with higher level of abstraction from the machine's physical parts). ...
0
votes
2answers
585 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 ...
1
vote
3answers
137 views

What drawbacks are there to condition-based scope?

In the pseudo code below, the variable key must be declared and initialized outside of the context which it is used/relevant because there are two disparate if-blocks with the exact same condition. I ...
21
votes
5answers
5k views

Why design a modern language without an exception-handling mechanism?

Many modern languages provide rich exception handling features, but Apple's Swift programming language does not provide an exception handling mechanism. Steeped in exceptions as I am, I'm having ...
0
votes
1answer
112 views

Are there any programming languages that use strict evaluation that also have overloaded values?

Haskell supports overloaded values, where a single overloaded value can behave sort of like a superposition of values each with a different type. For example, here's a simple type class: class Truthy ...
5
votes
2answers
418 views

Why do some programming languages have break statements, but not higher-order break statements? [closed]

I may have been exposed to exactly the wrong languages, but though many have loops and break statements, none of the languages I am familiar with have higher-order break statements¹. While a regular ...
3
votes
2answers
336 views

On concatenating adjacent string literals

C and C++ compiles adjacent string literals as a single string literal. For example this: "Some text..." "and more text" is equivalent to: "Some text...and more text" In other languages like C# ...
1
vote
1answer
338 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 ...
9
votes
5answers
1k views

Are there technical limitations or language features that prevent my Python script from being as fast as an equivalent C++ program?

I'm a long-time Python user. A few years ago, I started learning C++ to see what it could offer in terms of speed. During this time, I would continue to use Python as a tool for prototyping. This, it ...
20
votes
3answers
2k views

Why is a private member accessible in a static method?

The following is pseudo code, I tried it in Java and PHP and both worked: class Test { private int a = 5; public static function do_test(){ var t = new Test(); t.a = 1; ...
5
votes
2answers
1k views

Should I feel “uncomfortable” using auto in C++? [duplicate]

C++11 features the new auto type declaration, allowing you to work with an object without ever knowing its actual type. I use only strongly typed languages - C++, Delphi (Object Pascal), Go, etc and ...
3
votes
4answers
703 views

Why is there no 'subclasses-only' access modifier in Java?

In Java, there are four available access modifiers for methods: public - any class can use this method. protected - classes in the same package and subclasses in any package can use this method. ...
17
votes
5answers
3k views

Why is studying an lisp interpreter in lisp so important?

I have seen many CS curriculums and learning suggestions for new programmers that call for the aspiring programmer to study a lisp interpreter that is specifically written in lisp. All these sites ...
6
votes
6answers
1k views

Would a “downcast if block” be a reasonable language feature?

Consider the following "if cast": class A { public void f1() { ... } } class B : A { public void f2() { ... } } A a = foo(); // might return A or B if ( a is B ) { // Inside block, ...
1
vote
2answers
267 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 ...
2
votes
1answer
404 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
338 views

Languages supporting unicode logic operators

Are there any programming languages that support the use of unicode logic operators? For example, many programming languages use "!=" as the "does not equal" operator, but in mathematics the symbol ...
3
votes
2answers
597 views

Variable declaration versus assignment syntax

Working on a statically typed language with type inference and streamlined syntax, and need to make final decision about syntax for variable declaration versus assignment. Specifically I'm trying to ...
-2
votes
4answers
322 views

What are the advantages of converting empty strings to evaluate to true as compared to false? [closed]

When converting a string to a boolean, what are the advantages of having a programming language evaluate an empty string as true and what are the advantages of having it evaluate it to false?
-6
votes
4answers
443 views

Why must a constructor's call to the superconstructor be the first call?

It is an error if you do anything in a constructor before calling the superconstructor. I remember that I had problems because of that. Yet, I do not see how this saves us from errors. It could save ...
12
votes
6answers
4k views

In Java, why were protected members made accessible to classes of the same package?

From the official documentation... Modifier Class Package Subclass World public Y Y Y Y protected Y Y Y N no modifier Y Y N ...
6
votes
3answers
504 views

Is the usage of internal scope blocks within a function bad style?

There are some (quite rare) cases where there is a risk of: reusing a variable which is not intended to be reused (see example 1), or using a variable instead of another, semantically close (see ...
10
votes
3answers
1k views

Writing a Compiler Compiler - Insight on Use and Features

This is part of a series of questions which focuses on the sister project to the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. The ...
21
votes
6answers
2k views

How can I say that programming language compiles to other languages?

How can I say in english, that programming language can be compiled to other programming languages? The example can be Haxe. On the website the language is decribed as "Multiplatform": ...
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']; ...
-1
votes
4answers
674 views

Is is acceptable to create mediocre code now in preparation for new language features? [closed]

I'll be specific: Java 8 is promised to bring lambda expressions as well as method and constructor references among other things. As a Java developer I'm super psyched about that. In my day to day ...
8
votes
4answers
959 views

When to import names into the global namespace? (using x::y, from x import y etc.)

I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x ...
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 ...
6
votes
1answer
849 views

Are non Turing-complete languages considered programming languages at all?

Reading a recent question: Is it actually possible to have a 'useful' programming language that isn't Turing complete?, I've come to wonder whether non Turing-complete programming languages are ...
29
votes
6answers
3k views

Is it actually possible to have a 'useful' programming language that isn't Turing complete?

Where it is accepted that a language has to be Turing complete to be any good, is it actually possible to have a 'useful' programming language that isn't Turing complete? I should clarify that this ...
1
vote
4answers
576 views

Multiple attribution in Python, JS, …?

I accidentally discovered this a=b=c=d=e=f=2 in python(2.7)(and JavaScript a few minutes later) interpreter . Is this a feature or just the way the interpreter works, if is a feature how it is ...
-2
votes
1answer
620 views

Why C# has no monkeypatching? [closed]

I was reading about monkeypatching _ dynamically overriding the functionality of classes. C# allows dynamic extending, but no monkeypatching, which I find reasonable. But I wondered why they ...
2
votes
5answers
471 views

What do you call “X <= $foo <= Y” comparison?

While writing a Perl statement like if ( $foo >= X && $foo <= Y ) yet again, I wondered why many programming languages do not support the more comfortable form if ( X <= $foo <= Y ...
4
votes
8answers
538 views

Confusion regarding def function within Python

I've been learning Python for about 2 months now (Started with Learn Python The Hard Way, now reading Dive Into Python), and within both books, I still seem to be confused over this one bit of code. ...
10
votes
8answers
1k views

Why aren't design patterns added to the languages constructs?

Recently I was talking with a colleague who mentioned that his company was working on adding the MVC design pattern as a PHP extension. He explained that they wrote C code for adding Controllers, ...
3
votes
3answers
163 views

What actions should I not rely on the packaged functionality of my language for?

While talking with one of my coworkers, he was talking about the issues the language we used had with encryption/decryption and said that a developer should always salt their own hashes. Another ...
1
vote
2answers
173 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
1answer
442 views

Incorporating GoF design patterns in Objective-C without Abstract/Virtual classes

As someone who is becoming more comfortable working in Objective-C I would like to be able to incorporate more design patterns and OOP features in my projects but struggle to implement them as ...
7
votes
3answers
430 views

Is there a language where collections can be used as objects without altering the behavior?

Is there a language where collections can be used as objects without altering the behavior? As an example, first, imagine those functions work: function capitalize(str) //suppose this ...
0
votes
1answer
797 views

An alternative to multiple inheritance when creating an abstraction layer?

In my project I am creating an abstraction layer for some APIs. The purpose of the layer is to make multi-platform easier, and also to simplify the APIs to the feature set that I need while also ...
10
votes
3answers
4k views

Appropriate programming language to design music software [closed]

I want to design a software for my musical instrument which is a rhythmic one (there is no melody). All I want these software to do is : make the user able to compose music play what user has ...
23
votes
6answers
15k views

Why the static data members have to be defined outside the class separately in C++ (unlike Java)?

class A { static int foo () {} // ok static int x; // <--- needed to be defined separately in .cpp file }; I don't see a need of having A::x defined separately in a .cpp file (or same file ...
10
votes
7answers
419 views

What is a good alternative to the name variable for a language that only has immutable references or labels?

For example, in functional languages, variables are single assignment and their values are immutable once assigned. So they have two states unbound and bound, once bound they can't be changed. Is ...
11
votes
11answers
1k views

What do you do when you can't seem to understand a certain part of programming? [closed]

I'm learning new languages as I go along, I write code for very basic programs in multiple languages, and I go to classes. I've read books, articles, lessons, videos, you name it, however I can't seem ...
12
votes
5answers
2k views

Is there a specific purpose for heterogeneous lists?

Coming from a C# and Java background, I'm used to my lists being homogeneous, and that makes sense to me. When I started picking up Lisp, I noticed that the lists can be heterogeneous. When I started ...
5
votes
2answers
307 views

C++ users proposals

I believe I have some good suggestions to improve the C++ language. Who should I contact to discuss this? Do I have the chance to be heard, especially if I'm not a renowned expert?