My thoughts on language design

Type here, use edit.

That’s certainly a VERY interesting take. Here’s an alternative viewpoint: When the same concept is being referred to in multiple places, it is helpful to use the exact same name. You’ll see this even in human languages, and it definitely applies to programming languages. For example, the xml_declaration at the top of an XML file is still an xml_declaration even if you’re talking about it in some other function.

While it would certainly be possible to create a programming language in which your policy is enforced, it would be a nightmare to work with. We have namespaced variable names for very good reasons! And part of the value of that namespacing is that we CAN use the same variable name more than once, when it makes sense to do so.

Plus, recursion inevitably means you’ll be passing arguments to their equivalent names. If you call yourself, by definition the parameters to the call are going to have the same names as the local variables, since they are the exact same names.

In any case, even if this is somehow a bad practice, it’s definitely an extremely common one. Trying to force people into your idea of good coding style is as doomed to fail as putting a signpost in a river and expecting it to change direction :slight_smile:

7 Likes

I wonder what kind of context you work with because it seems enormously alien to me. In web dev it’s certainly the case that same-name is dominant, as you create dicts for json, to pass to template rendering, etc.

Maybe you could supply some context to what kind of domains you work in?

That was devoid of any answer or even coherence.

3 Likes

Could a moderator split these posts into a separate thread? Although the question was asked in good faith, I believe it’s a good point at which things can be split.

Someone’s personal philosophy about the use of software systems is not useful to the discussion at hand.

1 Like

So, what exactly IS a programming language? Isn’t it precise and to-the-point syntax designed to remove all ambiguity?

I am not sure what you’re trying to say here, and why is that relevant at all to our current discussion.

1 Like

(post deleted by author)

@DeletePlease Stay on topic and concise when interacting on the forum. Take a while to look around and observe how others post and interact, and compare to how your posts look here.