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
-6
votes
6answers
292 views

What would be generally accepted shorter version of `const`? [closed]

Now that we have const implemented javascript we can use it to declare variables. But unlike let or var it is 5-character long and I believe it is a big deal actually. Something that even slightly ...
4
votes
3answers
281 views

Why are minor breaking language changes not handled with transpilers?

For any successful programming language, making a breaking change to the language is extremely difficult. This is the case even for those changes where the legacy code could be reliably and ...
2
votes
2answers
254 views

Strategy for implementing Multiple Dispatch

This is a question regarding how Multiple Dispatch works. Suppose that we have a type hierarchy like this: Drawable -> Shape -> Polygon -> Rectangle And there are three functions (This is ...
4
votes
5answers
1k views

Type inference with duck typing - does this work? Why is it not used?

Suppose we have a functional language where objects don't have explicitly defined types, but where named properties can nonetheless be accessed on objects. Is it then possible for the compiler to ...
16
votes
5answers
749 views

Did the need for software design specification significantly decrease with the evolution of more expressive programming languages?

For many IT people, including myself a few years ago, the ideal software development process would involve the creation of detailed design documents with lots of UML diagrams before a line of code ...
10
votes
3answers
5k views

Learning programming language specifically designed for that company [closed]

Why would someone develop his own language to use it only inside that firm when you have XY other languages that can help you with their libraries, logic etc.? Isn't it way much simpler to go with the ...
-1
votes
2answers
196 views

Opposite of mutating [closed]

I am looking for an adjective; one that describes the opposite of "mutating". I want to use it to mark functions, methods and method parameters (including the receiver) as "not being mutated" by the ...
290
votes
16answers
27k views

Grokking Java culture - why are things so heavy? What does it optimize for? [closed]

I used to code in Python a lot. Now, for work reasons, I code in Java. The projects I do are rather small, and possibly Python would work better, but there are valid non-engineering reasons to use ...
50
votes
9answers
22k views

Why does Java have `void` methods?

Does / why does Java need to have void methods? Reference: Any method declared void doesn't return a value. As far as I can think, every use of void would be better served by returning a status ...
3
votes
0answers
226 views

Understanding Typescript's views on inheritance

I have been struggling to understand the reasons why typescript developers choose the way they implemented inheritance. What I would expect from any language supporting inheritance is these order of ...
0
votes
1answer
283 views

How do programmers retain knowledge of languages/technologies they don't use often? [closed]

How do programmers retain knowledge for languages/technologies they don't use on a regular basis? Take for example the PC Assembly Book. The author states he rarely uses ASM at all. Yet he was able ...
2
votes
1answer
719 views

Custom language with mixed markup and Python, parsing in Python

I need a system for creating Python subclasses in a simple manner, and I was thinking of using a (custom) config language similar to json, xml, etc. Here's the initial structure I thought of (one ...
5
votes
1answer
230 views

In more canonical OO Python situations, what is the rule of thumb for default access modifiers?

Generally speaking in canonical OOP situations, the rule of thumb is to write your classes with the least access as necessary. i.e. only make public only what is necessary, make protected only what is ...
6
votes
3answers
5k views

Why system calls are limited to C language as far as I see?

From my Operating System textbook, application and library interact with kernel by system calls. But as far as I can see, Windows, OS X and Linux, we can only use C Language to post system calls. ...
4
votes
4answers
331 views

How do programs written in higher languages take advantage of “dynamic execution” present in new Intel processors?

I have learned that new Intel processors can do "dynamic execution" (meaning out-of-order execution of instructions). How do programs written in a high level language take advantage of this? Does the ...
26
votes
10answers
7k views

Programming language where every function call/block is done in a separate thread? [closed]

I'm currently creating a programming language for fun where the idea is that every function call/new block (if clauses, loops etc) will work in a separate thread. Instead of creating new Threads the ...
6
votes
1answer
256 views

What is the difference between predicate and branch

I am confused about the difference between the branch and the predicate in a code. Can someone explain the difference with an example?
-2
votes
2answers
218 views

Categorize a language?

Is it true that one doesn't "implement a programming language"? I was told that in some comment around here several years ago and I read that actually you do "implement a programming language". The ...
-2
votes
1answer
79 views

Python Syntax Format

Since I am new to programming, I just want to understand the format the built-in functions is represented in the documentations. This is the one from python bytearray ([source[, encoding[,errors]]])...
2
votes
1answer
825 views

A web browser written using OpenGL, is it practical?

Games written using OpenGL are relatively easy to port to many platforms, and look and feel the same everywhere implementing their own UI. Web browsers have to solve a very similar problem. So, why ...
4
votes
1answer
844 views

Block Scoped and Function Scoped Languages

I've noticed that some languages like C, C++, Java, Perl, and .NET Visual Basic have "block" scoping which means that a variable will only be defined within the specific code block it was declared in. ...
0
votes
4answers
219 views

What are obstacles to creating a viable language that is not text&file based?

Please help brainstorm/dream about an important problem (I believe this is a valid question, if you think it's not a valid question, please give me concrete critique so I can work on it). Almost ...
-8
votes
2answers
124 views

Source Code Character Count Metric / Acronym?

I see wikipedia entries for: https://en.wikipedia.org/wiki/Source_lines_of_code aka SLOC. Shouldn't there be some other kind of metric like SCC? (source character count).. or maybe there is and I ...
-1
votes
1answer
292 views

GO - How to define methods of named type?

In GO, rule is, methods can be defined only on named type and pointer to named type. In C, below code, operations are defined on type(say List), typedef struct List List; //list.h typedef struct { ...
3
votes
2answers
2k views

Type safety - GO vs C pointers

C is a static-typed language that is not type-safe, because pointers(void *y) let you do pretty much anything you like, even things that will crash your program. GO is also a static typed language ...
-4
votes
1answer
175 views

Did GO embrace any language construct introduced in Java?

GO has embraced, 1) JavaScript/Python language constructs, Higher order function Closure Slicing Range operator Anonymous function(inner function) Provides abstractions ...
60
votes
14answers
13k views

Can we make general statements about the performance of interpreted code vs compiled code?

I'm comparing two technologies in order to reach a recommendation for which one should be used by a company. Technology A's code is interpreted while technology B's code is compiled to machine code. ...
0
votes
2answers
234 views

Where to start when creating a programming language? [closed]

I'm actually a programmer on a few languages, but I realized I really didn't know much how the computer works on a deeper level. So I thought a good idea to discover and learn how does it work was to ...
1
vote
2answers
227 views

How come language designers don't upgrade their global functions?

For example, when working with arrays there are methods like indexOf() that works like this: if (array.indexOf("something")!=-1) { // do something or nothing } Why hasn't someone made a contains ...
4
votes
2answers
94 views

Is there any good/fundamental reason that Python classvars, and JavaScript prototype inheritance, don't mutate the parent on assignment?

In Python, if you have a classvar, it's accessible from an instance, but if you set the variable on the instance it doesn't actually change the classvar, rather it assigns a new name which shadows the ...
6
votes
0answers
211 views

Worldwide programming languages? [closed]

I'm in the USA, and essentially only have visibility to coding languages in typical use in my USA-based business. These are primarily C++, C#, and Java. Are these languages that are common here also ...
0
votes
3answers
973 views

Definition of Generic function

1) Below is a python function summation, that can perform sum of cubes/squares/.., similar operations. def identity(k): return k def cube(k): return pow(k, 3) def square(k): return ...
0
votes
2answers
417 views

What's the point of Swift's function notation?

Why does Swift use this function notation: func greet(person: String, day: String) -> String { return "Hello \(person), today is \(day)." } Like, I don't get why it uses the small arrow -> ...
3
votes
3answers
189 views

How are namespaces used in the stack during scope lookups?

I'm taking a comparative programming languages course and have learned the bare basics of variable scopes with respect to stack frames -- e.g. static and dynamic links, offsets, etc. as in the image ...
5
votes
2answers
373 views

Why isn't it a common practice for languages to have method arguments passed inside method names?

Why is not it a common practice for languages to have method arguments passed inside method names? For instance, wouldn't something like: shop.Sell(15)Notebooks (although looking pretty unusual) be ...
4
votes
2answers
2k views

Was template meta programming really discovered “by accident”? [closed]

When I first saw this meme: I thought to myself, yeah right, but now I am not sure any more. So was template meta programming in C++ discovered by accident as the meme claims or was it intentional? ...
0
votes
3answers
167 views

Creating a metaphorical compiled scripted language.

I'm studying for a final exam and I came across this question which I found pretty interesting. I was wondering what the stackExchange community who are more experience in scripted languages than I ...
0
votes
0answers
141 views

Decided to code the new project in TypeScript, should everything be coded in this language?

We have decided to code the new project in TypeScript at the company. Does this mean that everything should be coded in this language? Discussion My first thought was Yes. On the other hand ...
0
votes
1answer
204 views

Is D3.js really data-driven?

In The Art of Unix Programming, Eric Raymond tells that the data-driven style is about creating small interpreters for "mini-languages" to allow controling the control-flow of the program at runtime. ...
5
votes
1answer
586 views

Are programming languages unit tested? [closed]

I'm just wondering—Are the programming language features unit tested? Basic features, i.e. built-in types, operators, arrays, generics, etc. The question applies to unit testing for runtime behaviour,...
68
votes
10answers
17k views

Why do languages require parenthesis around expressions when used with “if” and “while”?

Languages like C, Java, and C++ all require parenthesis around an entire expression when used in an if, while, or switch. if (true) { // Do something } as opposed to if true { // Do ...
2
votes
2answers
180 views

Can conditional break in a loop be rewritten for easier understanding?

while cond1 ... if cond2 ... else ... break The while loop above has two termination conditions, cond2 and !cond1 !cond2 When the commands that are represented ...
0
votes
2answers
172 views

How to remember code when you are working with a lot of languages? [closed]

Sometimes I work for a project that requires some programming languages for about 3 months, later I work for another project that requires a different set of languages. I know and studied of of these ...
4
votes
1answer
111 views

The bound mechanism by generics for a type variable to appear in its own bound

From Programming Languages: Principles and Paradigms By Maurizio Gabbrielli, Simone Martini The bound mechanism for type variables is fairly sophisticated and flexible. In particular, a type ...
8
votes
4answers
169 views

What is the programming language concept for not evaluating an expression by default in bash?

In Bash, to increase an integer value stored in a variable, we need to explicitly use arithmetic expansion. i=1 i=$((i+1)) Otherwise i=1 i=i+1 will not evaluate the expression i+1, but assign ...
3
votes
4answers
436 views

Design Pattern for Indirectly Connecting Two Classes

Admittedly, this is a homework problem but I have tried to figure it out on my own. Just want to make sure I get it correct. So far, the only design pattern I believe to be correct would be the ...
36
votes
6answers
14k views

Why is SQL the only database query language? [duplicate]

For general-purpose programming there are literally hundreds of programming languages. But for interacting/querying the databases, why is SQL pretty much the only used language?
15
votes
2answers
2k views

How are generics implemented in a modern compiler?

What I mean here is how do we go from some template T add(T a, T b) ... into the generated code? I've thought of a few ways to achieve this, we store the generic function in an AST as Function_Node ...
51
votes
3answers
8k views

What is a type system?

Background I am designing a language, as a side project. I have a working assembler, static analyser, and virtual machine for it. Since I can already compile and run non-trivial programs using the ...
-1
votes
1answer
79 views

Two questions about Simula [closed]

I am looking over Simula language to see how it compares to C++/Smalltalk, and I have two questions that are difficult to find answers to because each time I type in Simula into Google, it gets ...

1 2
3
4 5
27