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

5
votes
4answers
658 views

Can you name some pattern matching languages for non-strings? [closed]

Regular expressions and are popular matching patterns in strings. What similar handy languages exist to match other data structures? I know XPath for XML trees, but I have not seen use of it for other ...
18
votes
3answers
1k 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; ...
0
votes
1answer
598 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 ...
1
vote
4answers
405 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 ...
5
votes
2answers
949 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 ...
10
votes
6answers
625 views

Where, in an object oriented system should you, if at all, choose (C-style) structs over classes?

C and most likely many other languages provide a struct keyword for creating structures (or something in a similar fashion). These are (at least in C), from a simplified point of view like classes, ...
3
votes
4answers
218 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. ...
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
199 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 ...
3
votes
1answer
320 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 ...
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 ...
11
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 ...
2
votes
1answer
207 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
250 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
289 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?
19
votes
16answers
2k views

Why aren't databases integrated as a language feature?

Are there any programming languages that have a built-in database as a first-class language feature rather than connecting to an external SQL (or other) database? What would be the drawbacks and ...
21
votes
6answers
7k 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 ...
-6
votes
4answers
355 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 ...
10
votes
6answers
2k 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
1answer
664 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 ...
6
votes
3answers
420 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 ...
21
votes
6answers
1k 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
1k 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']; ...
8
votes
4answers
511 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 ...
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, ...
-1
votes
4answers
644 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 ...
10
votes
5answers
879 views

First Class Functions

I started seriously taking a look at Lisp this weekend (by which I mean I have only been learning Lisp and not reverting back to projects in C#) and must say I love it. I have dabbled with other ...
1
vote
3answers
897 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 ...
47
votes
9answers
14k views

What is a closure?

Every now and then I see "closures" being mentioned, and I tried looking it up but Wiki doesn't give an explanation that I understand. Could someone help me out here?
26
votes
5answers
2k 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 ...
2
votes
2answers
106 views

Problem understanding what “Exporting functions means”

I cannot understand what the following means "ISAPI applications can be written using any language which allows the export of standard C functions, for instance C, C++, Delphi." What is "allowing ...
-2
votes
1answer
500 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 ...
3
votes
5answers
443 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 ...
0
votes
2answers
636 views

Static and dynamic programming languages [closed]

Someone who's just getting started in programming asked me about the advantage of different approaches programming languages take. For example, some allow the programmer to omit variable declarations ...
11
votes
3answers
3k views

Appropriate programming language to design music software

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 ...
3
votes
3answers
162 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
1answer
399 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 ...
1
vote
2answers
159 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 ...
6
votes
3answers
390 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 ...
6
votes
5answers
332 views

Is there a better term than “smoothness” or “granularity” to describe this language feature? [closed]

One of the best things about programming is the abundance of different languages. There are general purpose languages like C++ and Java, as well as little languages like XSLT and AWK. When ...
9
votes
5answers
886 views

Why no fortran standard library?

To be a language focused on mathematics and scientific computing, I am always baffled by the total lack of useful mathematical routines in the Fortran standard library. One would expect it to be ...
15
votes
9answers
1k views

Are optional parameters helpful or a hindrance to application maintenance?

As stated in the title, are optional parameters, such as those used in C# helpful or are they a hindrance to application maintenance and should be avoided as they can make the code harder to ...
6
votes
7answers
2k views

How do you choose to use a specific programming language?

I was having a small talk between teammates about how you choose a programming language for use in a project which lead me to think that there are many criteria to choose one in the beginning of a ...
10
votes
7answers
383 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 ...
14
votes
10answers
924 views

Help me catch up on what I've missed since Java 1.4.2 [closed]

I am about to start my first professional career position as a software developer, and I'm likely going to be writing a lot of Java code. I don't know that much about what specifically I'll be ...
11
votes
5answers
1k 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 ...
17
votes
24answers
1k views

Interesting or unique types in programming languages? [closed]

We have all seen integer, floating point, string, and the occasional decimal type. What are some of the most strange or unique or useful types you have encountered, useful or not?
5
votes
2answers
288 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?
2
votes
7answers
235 views

What's a good way to prepare for this course titled “Programming Language Security”?

I have a course with the following description: The purpose of this course is the study of programming language security features and languages designed to support it explicitly. Static and ...