Skip to main content

New answers tagged

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. ...
Marc van Leeuwen's user avatar
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 ...
gnasher729's user avatar
  • 46.7k
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 &...
gnasher729's user avatar
  • 46.7k
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:", ...
candied_orange's user avatar
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 ...
tarzh's user avatar
  • 119
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 ...
Michael Shaw's user avatar
  • 10.1k
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 ...
Karl Bielefeldt's user avatar
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 ...
Christophe's user avatar
  • 79.9k
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 { $...
Andy Kluger's user avatar
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 ...
Walter Mitty's user avatar
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 ...
Josh Brunton's user avatar
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 ...
Chris Schaller's user avatar
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 ...
Graham's user avatar
  • 2,044
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 ...
Flater's user avatar
  • 54.8k
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 ...
Steve's user avatar
  • 10.3k
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 ...
Basilevs's user avatar
  • 2,819
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 ...
jmoreno's user avatar
  • 11.1k
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 ...
Telastyn's user avatar
  • 110k

Top 50 recent answers are included