New answers tagged programming-languages
0
votes
Immutability across programming languages
Immutability is not a very fundamental notion in programming; what it means (if anything) is highly dependent on details of programming language semantics, such as argument passing conventions. ...
0
votes
Why use parentheses for function call when no arguments are passed?
The real reason why you need parentheses for function calls with no arguments is that Mr. Ritchie thought it was better that way and implemented it that way. And that afterwards, nobody could come up ...
2
votes
Immutability across programming languages
I'd start with C and C++, where things are reasonably simple. You have "objects" in memory, not in the sense of object oriented programming, but items that can be read or changed. These &...
1
vote
Immutability across programming languages
x = 10
x = 20
This is not shadowing.
This is shadowing:
x = 0
def outer():
x = 1
def inner():
x = 2
print("inner:", x)
inner()
print("outer:", ...
1
vote
Immutability across programming languages
The dangers of mutation specifically apply to alias mutation; a lot of times when people claim "immutability", what they really claim (or want) is alias immutability.
An alias is a value ...
6
votes
Immutability across programming languages
Welcome to one of the fun quirks of programming in different languages (and their different semantics)
In a general sense, whether something has the property of mutability, or if there is simply ...
21
votes
Immutability across programming languages
This is a common confusion with immutability. There's a difference between an immutable value and an immutable reference.
For example, say you have x = 10. You can't do something like 10 = 20 to ...
4
votes
Immutability across programming languages
In general, the mutability says that the values of object can be changed. Your C++ example is indeed mutability, because x is an int object, that the value 10 is stored in the object and that the ...
1
vote
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
To add an example language + environment that does support this: Factor!
If you'll forgive my non-default prompt (🦖):
🦖 SYMBOL: lowest-bound
🦖 10 lowest-bound set
🦖 HELP: lowest-bound { $...
1
vote
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
Been there, done that.
In a language called MDL (aka MUDDLE) it was possible to associate any object with any other object, and give the association a name, such as "comment". This means ...
5
votes
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
Looks like you're programming in Python, so to start with that as an example: There's absolutely something like this! They're called "docstrings" (short for documentation strings), because ...
6
votes
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
As detailed by the previous answers, there are both IDEs and Programming languages do have support for this.
Support comes in three general categories:
Documentation in the code that must be ...
3
votes
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
Some languages such as Java, C#, Python and others already have built-in capabilities for this: respectively, Java's JavaDoc comment format, C#'s documentation comment format, and the various ...
41
votes
Accepted
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
Why doesn't it exist?
The direct answer here is that this isn't technically impossible, no one has just been sufficiently bothered enough by it to create a field-spanning standard that everyone can ...
12
votes
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
It's a good question, and some IDEs do have the functionality you suggest, but virtually all programming languages and IDEs have the simple ability to add comments like so:
// The lowest integer ...
39
votes
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
TLDR
Decomposition makes names shorter. Do not fight symptoms, solve underlying problem instead.
Scope is important
Naming is the hardest problem, not because long names are not readable, but because ...
2
votes
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
They have, by moving to OOP. There’s all kinds of tools for adding meta data to class values from xml markup to attributes and even whether they are properties or not.
But it sounds like you are ...
28
votes
Why don't programming languages or IDEs support attaching descriptive metadata to variables?
Java and C# at least have this sort of feature. Javadoc is the system for it in the Java context, Documentation comments in C# context. Indeed, that’s how IDEs provide on-hover info at all.
Generally ...
Top 50 recent answers are included
Related Tags
programming-languages × 1405language-design × 150
java × 82
c × 75
c++ × 69
object-oriented × 67
programming-practices × 65
compiler × 64
functional-programming × 60
python × 58
history × 58
language-features × 53
language-agnostic × 52
learning × 51
c# × 45
syntax × 45
javascript × 42
design × 40
php × 34
parsing × 29
terminology × 28
type-systems × 27
web-development × 21
interpreters × 19
design-patterns × 18