Artificial languages for instructing computers to do steps of computation in order to complete tasks. They allow programmers to communicate with computers.
-4
votes
1answer
53 views
Need input on hackathon ideas [on hold]
me and my team are planning to go to a Dementia based Hackathon early March and since this is our first actual hackathon we were wondering if you could provide some advice regarding our idea. Here's ...
2
votes
1answer
119 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
130 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 ...
-5
votes
2answers
70 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 SCOC (source characters ...
0
votes
1answer
85 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
147 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
104 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 ...
56
votes
14answers
11k 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
138 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
203 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
83 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
169 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
149 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
1answer
127 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
77 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
294 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 ...
2
votes
2answers
272 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
130 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
91 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
104 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
252 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,...
64
votes
10answers
14k 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
149 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
148 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 ...
0
votes
0answers
48 views
Front end code and quality [duplicate]
I'm a software developer since 3 years and I'm really interested in Javascript since ~1,5 years.
I have a backend profile at first, and I'm familiar with SOLID, DDD and some other kind of making code ...
4
votes
1answer
76 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
143 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 ...
4
votes
4answers
317 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 ...
31
votes
6answers
4k 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?
7
votes
2answers
478 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 ...
41
votes
3answers
2k 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 ...
0
votes
1answer
36 views
Two questions about Simula
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 ...
3
votes
3answers
285 views
How do programming languages work?
This is probably a dumb question, but how do programming languages work on a low level? If you go to the Go language GitHub page here, it says almost 90% of the source files are Go files. How is it ...
-2
votes
1answer
65 views
Rotate a matrix in place, moving elements? (How to write a part of flow/logic after understanding the problem?)
Following is a java solution of the classic question of rotating a nxn matrix in place clockwise by 90 degrees.
public void rotate(int[][] matrix, int n) {
for (int layer = 0; layer < n / 2; ++...
2
votes
1answer
190 views
Why is there such a fight for companies to produce new languages + frameworks
There's currently a huge growth in larger companies offering new languages and / or frameworks for us to use to create websites, apps or software and I'm interested to know for what reason do people ...
2
votes
2answers
180 views
Is a linked list considered a collection of objects?
Sedgewick's Algorithm 4ed says
Several fundamental data types involve collections of objects.
Specifically, the set of values is a collection of objects, and
the operations revolve around ...
62
votes
10answers
12k views
Syntax Design - Why use parentheses when no arguments are passed?
In many languages, the syntax function_name(arg1, arg2, ...) is used to call a function. When we want to call the function without any arguments, we must do function_name().
I find it odd that a ...
4
votes
2answers
244 views
Java Design Philosophy
I was reading through design philosophy of java and this line struck me:
"The VM checks whether the signature of the Java code is valid and would refuse to interpret if any change of the code is ...
1
vote
1answer
40 views
Relation and difference between recursively enumerable languages and Turing complete languages?
From https://en.wikipedia.org/wiki/Recursively_enumerable_language
a formal language is called recursively enumerable (also
recognizable, partially decidable, semidecidable, Turing-acceptable or
...
0
votes
2answers
197 views
Is there a need for thenif besides elseif?
For nested if constructs, some languages provide constructs similar to
if Bexp1 then C1
elseif Bexp2 then C2
...
elseif Bexpn then Cn
else Cn+1
endif
All I have seen provide elseif. I wonder ...
18
votes
6answers
5k views
What is the mathematics foundation for first/second/third class values in programming languages?
Added
Just found two related questions
http://math.stackexchange.com/q/1759680/1281
http://stackoverflow.com/a/2582804/156458
In programming languages, from Michael Scott's Programming Language ...
0
votes
3answers
73 views
Are commands for variable initialization ever used as expressions?
In C, the assignment command also returns the value assigned, so it is also an expression.
Similarly, initialization, which happens when defining a variable, also assigns a value to the newly created ...
1
vote
1answer
140 views
How does static scoping apply to recursive functions?
Under static scoping, by its definition, how can we determine the scope of a variable inside a recursive function?
For example, in a pseudo-language,
int i=1;
function myfun(){
if (i > 4){
...
0
votes
1answer
39 views
Relation between static and dynamic bindings and scopings?
From https://en.wikipedia.org/wiki/Name_binding
name binding is the association of entities (data and/or code) with
identifiers.[1] An identifier bound to an object is said to reference
that ...
0
votes
1answer
127 views
Differences between deep and shallow bindings for static scoping
I am self-learning Michael L. Scott's Programming Language Pragmatics. The following quote explains how deep binding and shallow binding are different in the presence of static scoping:
program ...
2
votes
1answer
93 views
Can dynamic typing and dynamic scoping lead to each other?
By definition, dynamic typing and dynamic scoping have different purposes. But some cases make me wonder if they can lead to each other sometimes.
Dynamic typing allows a name i.e. identifier to ...
24
votes
1answer
926 views
Why was the caret used for XOR instead of exponentiation?
Not that it's really a problem for anyone that has faced this syntactic issue before, but I see a wild amount of confusion stemming from the use of the caret (^) as the XOR operation in lieu of the ...
4
votes
0answers
102 views
Create in-browser IDE for own grammar
We are going to use our new own programming language. We have designed grammar, json parser and everything seems to work.
Code in my language is transpiled into javascript and interpreted by node.js ...
3
votes
2answers
268 views
How is a abstract syntax tree used to execute source code?
After researching how a parser generates an AST, I believe that I can know attempt to create one. Before I started on this project, I began to ponder what I should be done next after creating a AST ...
0
votes
2answers
154 views
How do I determine the visibility of “objects” as defined in the C programming language?
This question was asked by my professor in an exam and I couldn’t find an answer on Google, so here I am.
I don't understand what objects are in C at all.