Questions tagged [programming-languages]

Artificial languages for instructing computers to do steps of computation in order to complete tasks. They allow programmers to communicate with computers.

Filter by
Sorted by
Tagged with
7 votes
3 answers
1k views

Is prototypal inheritance inherently slower?

I see Javascript 6 will add traditional class based inheritance, and one argument I hear is that classes are inherently much faster than prototypes because they can be optimized away by the compiler ...
-3 votes
1 answer
217 views

Managing a project with an unfamilar programming language

Is there any common wisdom for managing a software project in an unfamiliar programming language? Most software projects go for safety and use some mainstream language but some opt for a niche ...
0 votes
2 answers
83 views

I've a doubt regarding Environment Model of execution

I came across Environment Diagrams,it is described below Whenever Python needs to work with an object, that object is stored in memory; and, additionally, Python also needs a way to associate names ...
13 votes
8 answers
6k views

How do compilers work in a language that doesn't allow recursion?

I'm recently learning the programming language, and I wonder how compilers work when the language itself does not allow recursion, like how the compiler or the runtime checkers makes sure that there ...
2 votes
2 answers
419 views

Can access modifiers be completely replaced with programming to interfaces?

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed ...
8 votes
5 answers
8k views

Is code written inline faster than using function calls?

I wrote some script in Python that creates a giant 2D matrix (1000x1000 or bigger) and fills it with random numbers. And after that, it goes through every element of the matrix and changes the number ...
86 votes
11 answers
34k 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, new instance of String created. What might be the reason of immutability ...
50 votes
9 answers
19k views

Why didn't == operator string value comparison make it to Java?

Every competent Java programmer knows that you need to use String.equals() to compare a string, rather than == because == checks for reference equality. When I'm dealing with strings, most of the ...
-1 votes
3 answers
3k views

What is the reason behind methods with return values and methods with void?

I want to uderstand why there is a method in C# that could reurn a value, for example: public int Accelerate() { Speed++; return Speed; } and a method that does not reurn a value (void)? What ...
28 votes
9 answers
8k 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 ...
11 votes
1 answer
3k views

Are "normal order" and "call-by-name" the same thing?

I was studying the book Structure and Interpretation of Computer Programs and in section 1.1.5 The Substitution Model for Procedure Application the author explains the concepts of normal order and ...
10 votes
3 answers
3k views

Are closures with side-effects considered "functional style"?

Many modern programming languages support some concept of closure, i.e. of a piece of code (a block or a function) that Can be treated as a value, and therefore stored in a variable, passed around to ...
20 votes
5 answers
13k views

What is the difference between syntax and grammar?

I understand the difference between syntax and semantics - Syntax: how the symbols are combined to form a valid expression or statement. Semantics: the meaning of those symbols that form an ...
7 votes
4 answers
2k views

Why do some of object oriented languages let programmer use primitive types?

Why do some object oriented languages let the programmer use primitive data types? Aren't classes like Integer, Boolean, etc. enough?
-2 votes
4 answers
233 views

Block structured iteration and recursion

Programming languages traditionally have blocks that specifically cater to controlling iteration. There is the simple while-loop: while (i < 3) {...}; Then there is the more complicated for-loop: ...
4 votes
2 answers
2k views

Multidimensional vs nested arrays

A seemingly basic question here. Is there anything you can do with multidimensional arrays that you can't do with nested arrays? Many languages have been designed with both facilities and syntactical ...
8 votes
1 answer
247 views

Learning a new language using broken unit tests [closed]

I was listening to a dot net rocks the other day where they mentioned, almost in passing, a really intriguing tool for learning new languages -- I think they were specifically talking about F#. It's ...
9 votes
3 answers
1k views

Did concept of ViewModel exist before MVVM?

Today I was having a discussion with a colleague that ViewModel is a general concept and existed before MVVM pattern. I believe ViewModel term is used anytime you create a class with Model like ...
4 votes
3 answers
2k views

Should I mix python and .NET?

So I have a good handle on how to rapidly develop a GUI controlled application in .NET (not so much in Python, I've only used Tkinter). I want my code to be easily deployed with very few dependencies....
12 votes
8 answers
35k views

Why might an ASP.Net website load slowly? [closed]

Anecdotally, I've visited many .aspx website that require a significant amount of load time for each page. Is my experience unique? If not, why might an ASP.Net website load slowly? Edit: It's now ...
39 votes
6 answers
12k views

What is the philosophy/reasoning behind C#'s Pascal-casing method names?

I'm just starting to learn C#. Coming from a background in Java, C++ and Objective-C, I find C#'s Pascal-casing its method-names rather unique, and a tad difficult to get used to at first. What is the ...
1 vote
4 answers
632 views

Could a language allow for persistent allocations without heap?

Is it possible in theory to have a programming language that allows for object lifetimes that exist beyond the current scope but without using heap? As a little background, in embedded development it ...
1 vote
3 answers
656 views

Why does HTML collapse whitespace?

I've been trying to better understand (at least at a high level) why the early versions of HTML were designed the way they were. Most of the decisions make sense; I can deduce (at least at a high ...
1 vote
2 answers
244 views

What does "legacy signature" mean?

I see the term legacy signature a lot in the documentation of programming languages. For example in the php documentation : Passing the separator after the array (i.e. using the legacy signature) ...
6 votes
11 answers
3k views

If python compiles to assembly and an OS is written in it, will it compete favorably with C in benchmarks?

Ok, I have used the word python in the question, but it well could be language agnostic in that: If a language X has a well optimised compiler targeting assembly and an OS is written in that language, ...
2 votes
6 answers
11k views

Is there any specific reason to use "else if" clause?

We all use if ..else if.. else. But still I'm confused as to why we use else if. Where if does the same thing as else if. So why are we using else if? Any specific reasons behind this? Is there ...
-5 votes
1 answer
969 views

In what programming language is Python's regex module written in? [closed]

If I try to rewrite specific regex functionalities (e.g. substituting a string) in Python, a solution using the regex module is always faster. Is regex written in C?
0 votes
0 answers
206 views

What is it about kdb/q that makes the grammar not suitable for ANTLR style parser generators?

I want to build a code analysis tool for personal use when programming in kdb/q. In order to do this, I need to be able to parse q code into an AST. I have never written a parser before. ANTLR4 seems ...
14 votes
3 answers
6k views

Documenting a programming language: Reference Manual

We are looking at revamping documentation across our product line. Part of that includes reference manuals for a programming language used as part of the system. When writing a reference manual for a ...
84 votes
6 answers
19k views

Why does the type go after the variable name in modern programming languages?

Why is it that in nearly all modern programming languages (Go, Rust, Kotlin, Swift, Scala, Nim, even Python last version) types always come after the variable name in the variable declaration, and not ...
47 votes
5 answers
19k views

When does it make sense to compile my own language to C code first?

When designing an own programming language, when does it make sense to write a converter that takes the source code and converts it to C or C++ code so that I can use an existing compiler like gcc to ...
85 votes
14 answers
14k views

Do objects in OOP have to represent an entity?

Does an object have to represent an entity? By an entity I mean something like a Product, Motor, a ParkingLot etc, a physical, or even a clear-cut non-physical conceptual object -- something that ...
0 votes
3 answers
745 views

Are there languages that allow goto statement to only go down?

goto statements can sometimes be useful to go down (to lower lines of code) in code, but can create a mess if used to go up (to higher lines of code). Therefore, I am wondering if there is any ...
17 votes
3 answers
7k views

Is it true that "Real programmers can write assembly code in any language."?

Real programmers can write assembly code in any language. (Larry Wall). As far as I can make out, Mr. Larry Wall is trying to say that to a real programmer any language can have the same ...
4 votes
3 answers
20k views

Subscript binding and array categories

I am learning "Programming languages principles" and there is a lot of information about stuff which make up a programming language . Unfortunately every material I came across until now has a lot of ...
1 vote
5 answers
948 views

Do state machine based programs have a processing loop - or even exist?

Short Version If we had an application based on a state machine - transitioning between states to run the application: is repetition, and in fact the entire state machine, based on the presence of an ...
9 votes
2 answers
24k views

complex numbers in programming?

Are complex numbers used in programming? If they are what is their significance? What IDEs and languages use them? And would it be recommended to learn how to implement them for a programming job (if ...
75 votes
4 answers
15k views

What are the biggest differences between F# and Scala?

F# and Scala are both functional programming langugages that don't force the developer to only use immutable datatypes. They both have support for objects, can use libraries written in other languages ...
0 votes
2 answers
405 views

Do any programming languages let you use other languages without restriction within them?

This may be a stupid question, and it would certainly take one Hell of a lexer, but do any extant programming languages allow you to do something like: c# (1.2) { // c# code } Perl (5) { # ...
-1 votes
2 answers
247 views

Why do most AST trees use classes instead of vectors

I've noticed that most AST tree implementations use classes for nodes instead of something like a vector. I want to ask, why do most people use classes? Are there issues to using vectors to make AST ...
3 votes
1 answer
155 views

Choosing the design of a scientific DSL: purely or impurely functional?

My aim is to create a language specific to the scientific field (which would be used mainly in the field of machine learning and physics) which would be based on the functional paradigm, a paradigm ...
3 votes
2 answers
363 views

Moderate discussion on choice of programming language

Assume you have a small set of suitable programming languages (e.g., Python, C++, Julia), a clearly defined task (development of software services in the context of computational sciences), and a team ...
17 votes
5 answers
23k views

How to determine if a programming language is verbose or terse? [closed]

Programming languages can often be described as verbose or terse. From my understanding, a verbose language is easy to read and understand, while a terse language is concise and neat, but more ...
14 votes
4 answers
2k views

What were the historical conditions that led to object oriented programming becoming a major programming paradigm?

What were some of the economic (and other historical) factors that led to object oriented programming languages becoming influential? I know that Simula started things off, but was the adoption of OOP ...
0 votes
1 answer
232 views

Excessively verbose and cryptic comparisons in Java

I don't know if this is the right place to ask more of a "philosophical" question. The more I code in Java, the more I have to bear with Comparable<T>. And the more I bear with this ...
3 votes
6 answers
2k views

Should I use a source-to-source or a traditional compiler in order to develop my own Programming Language?

I'm really interested in writing my own general-purpose high-level programming language, but I'm somewhat confused. I know that Python and Ruby were written in C, which makes me wonder that if I want ...
3 votes
3 answers
2k views

How are basic functions implemented in a programming language if they are not built in? [closed]

The lowest levels of a programming language's library functions are always obscure and often have no code that looks like it even remotely does anything. Some languages have these functions like ...
13 votes
5 answers
1k views

Analyzing a programming language

In SICP, the authors state (Section 1.1) that there are three basic "mechanisms" of programming languages: primitive expressions, which represent the simplest entities the language is ...
37 votes
7 answers
9k views

Why do programming languages allow shadowing/hiding of variables and functions?

Many of the most popular programming languges (such as C++, Java, Python etc.) have the concept of hiding / shadowing of variables or functions. When I've encountered hiding or shadowing they have ...
50 votes
14 answers
8k views

Why are errors named as "Exception" but not as "Error" in programming languages?

I've been thinking about that for quite a while actually. I am not a native English speaker myself but still, I have years of programming experience and I always asked myself this. Why is it named as ...

1
2
3 4 5
29