Programming languages with only global scope?

All of the discussion would become obsolete in case of required uniqueness of symbol names and usage of global scope variables only. The more not really needed options to choose from implemented in a programming language the more confusion and fruitless discussions. The core cause of all of this is mixing multiple ingredients which do not belong together into one soup. The convenience of using short symbol names is what a programming language should not care about at all. It’s part of pre-processing or another user-defined shortcuts appropriate in given case of seeking for brevity and reduction of required keystrokes for typing variable names. There are IDEs who need to take care of it … instead of a programming language which should insist on uniqueness of naming, best in style of UUIDs . Git does such hashing to achieve uniqueness over all repositories … so why not equip each software project with some preliminary code defining unique shortcuts for the UUIDs of the symbol names, methods, packages the compiler/linker can check for uniqueness in the context of a project? Julia already uses hashing to give the packages an unique ID taking for this purpose an 8 byte part of the 40 byte Git hash. So why not get generally rid of the idea of scoping? Because all of the other programming languages support this idea? This is a really bad choice of a reason …

Good luck writing a large program — there are decades of experience in why software engineers are wary of global scope, because it makes it too easy for one part of the program to have unexpected effects on another part of the program. It’s why, in languages that lack namespaces (e.g. C), people often end up emulating them with long prefixed_with_namespace_symbol conventions. Programming languages, over time, have evolved towards more nested namespaces/scopes, not fewer. And writing long “scripts” that almost entirely reside in a single global scope is widely discouraged by most experienced programmers.

If you want to develop your own programming language that bucks the trend, knock yourself out! But it’s pretty offtopic in this forum — I can confidently predict that Julia will never abandon the idea of local scopes.

15 Likes

Yes, this is the current reality as it is … with all the consequences.

91d

Well, but the confusion is not between local and global and only global scope would not allow to define [closures](Closure (computer programming) - Wikipedia. Imho, the real confusion is that = is used for both, binding, i.e., introducing a name in a new scope, and assignment, i.e., changing the value of an existing binding. E.g., in Lisp this problem does not arise as binding forms such as lambda or let are clearly separated from assignment forms such as setf.
Further, the lambda calculus solves both of your issues, i.e., regarding renaming bound variables (called alpha-conversion) as well as De Bruijn indices which denote scope unambiguously without named variables. The latter are rarely used though as people like descriptive names – instead of numbers – to refer to variables.

3 Likes

May you please elaborate on this one? What does a function prevent from defining an own set of global variables with a prefix of own identity it can re-use on next call?

That’s called a module.

Nothing, you can make a function that only assigns external global variables in its own module with no other functions. Nobody does it because too many persistent variables are awful for performance and memory. If you have an idea to get around that, make a proof-of-concept to inspire “all of the other programming languages”, or more likely rediscover “all the consequences.”

1 Like

Nice advice with welcome intention, but … you can’t convince by evidence if others are not willing to see this evidence because the forest of the message is hidden behind the thick layer of trees making it impossible to take a look at it. I have tried to point out the most important step on the path to it in this forum (also the evidence is already there put into texts available on Internet), but … the result was deletion of my postings. So let me tell you that if you believe that evidence alone is able to convince, you are on a path which leads in the wrong direction considered from the perspective of time and sufficiently increased experience.

As far as I can see, nothing has been deleted, but some contributions have been moved into separate threads to keep the discussions on topic.

What I have been wondering about is: what is oOo, do you have some links to something to read about?

4 Likes

I hate to throw any water on this grease fire, but here goes.

@oOosys, every one of your comments I’ve seen boils down to the following:
“You are wrong. Everyone is wrong. I am trying hard to show you and everyone that I am right, but you just don’t get it.”

This is:

  1. Alienating. It is rarely anyone’s intention to alienate, but your comments nevertheless do it. I don’t know if you’re aware of that. If not, here is someone telling you :slightly_smiling_face:. If you are aware of it, but unbothered by it, know that alienating your discussion partners and audience is a bad way to get a message across, and a way to make yourself disliked over time.
  2. Simplistic. I can assure you: you have not understood all of the lessons learned by all those who have learned lessons before you. There is, sometimes, perhaps often, a reason for why “things are the way they are”. Since there are hundreds of programming languages, and some are quite popular, and some others are quite loved, there are sometimes pretty good reasons why the designs of those languages are what they are. The people who designed them tend to be very smart, very well informed on the matter, and very intentional. Maybe you are young and passionate, I don’t know, but hopefully this is something you know. If not, here is someone telling you: many things in the world were already designed by geniuses; you’re not the first guy with an idea.
  3. Inflammatory. Your posts generate a lot of discussion. That is because they are very inflammatory. Perhaps you are used to being disagreed with in these discussions. If that’s a thing you’ve noticed happen repeatedly, one reason for that is that your approach forces people to be defensive (they must defend themselves against the accusation of “insanity” or incompetence, or stupidity, or lack of knowledge, or whatever else). Putting your discussion partner / audience in a defensive mode is not an effective way to convince, or to develop or transfer ideas. It is a good way to create an argument, and incite frustration. If this is your goal, then this is a great strategy. Otherwise, it is not.

On the contrary. Whenever someone makes a bold claim, the response is always: “prove it”. You cannot convince others without evidence. You want to convince people that everyone before you is wrong? Prove it.

7 Likes

Nothing actually, but you would need a way to generate such prefixed names at runtime:

make_adder(x) = (y -> x + y)
f1 = make_adder(1)  # x in make_adder bound to 1
f2 = make_adder(2)  # now, x bound to 2
f1(3), f2(3)

Thus, __make_adder_x or something would not work as each call, e.g, f1, f2, needs a different binding.

Thank you much for the effort of explaining the issues I am facing on my way not really aware of all of them, or at least not at this level of clarity you have reached in your message nailing it down what I am actually probably missing to have an idea about.

If you are honestly interested to see some “evidence” this Is the shell scripting language the oldest and best one? - DEV Community may be a good start.

I am looking around trying to find others which can cope with my style staying constructive instead of defensive (people able to behave like ChatGPT …) . Probably I am also in this forum not the right person at the right time and the right place, even if it appears that this forum is smarter than the other ones I have tried myself with yet.

See it this way: people are making experience how devastating wars are not for decades but already for thousands of years … do you see the result of this experience being increase of the military budget for guns and means of destruction along with sparking wars around the world based on what the smartest of the smart came up with up to now the way it should be? Proven by thousands of years of experience and engagement of the most genius people on this planet able to bomb Hiroshima and Nagasaki to ruins and death with only two bombs?

The experience … it is the core of your argumentation about the state of the art in programming, isn’t it? Are you aware of it?

I probably know how to behave “well” in this alien and partially very evil world … but … does it help to spread the word of enlightenment? Does it help in awaking anybody from sleep to be silent and full of respect for their ignorance of what actually is?

The most important goal is not to show any evidence of anything … the actual goal is to change the goals the people are after … See the Internet … An ongoing war increasing the need for a high bandwidth I need to pay for in order to stay informed and to be part of what is going on at all. If the goals diverge ,… there can’t be any understanding. This is not a well and wide known truth, or is it? Understanding and fruitful discussion needs that the goals are at least similar if not exactly the same. The goal decides about what is true and what not … and not any kind of evidence. If someone want to become a millionaire or earn his living with programming the path of oOo is not what would help him … is not what is true from this perspective. This makes any discussion not worth the time it takes as it would lead nowhere …

May the power of oOo be with you!

I have read your comment, but I will not reply to most of it. I’m not interested in having a discussion with you about the nature of good and evil and philosophy and war and all that.

Don’t. People are not automatons, they’re people. Don’t look for the the ones that act like mindless robots. Learn to have the kinds of discussions that lead to better outcomes for you and others. That is: change yourself to become the kind of discussion partner that others want to talk with. Learn, from how others respond to you, how you could better get your ideas across next time.

I don’t know where else you’ve tried, but sure, many people around here are extremely smart. Many people in many places are smart though :smile: . People will be more open to your ideas if you present those ideas in convincing, enticing, welcoming, humble, ways.

Cool, no problem. Prove your goal is better than my goal, and maybe I will accept your goal as mine. Until then, my goals seem pretty good :slightly_smiling_face:

I disagree. A fruitful discussion is its own goal, which you should regularly set as your main one.

2 Likes

Nice final statement in the discussion. Yes, you are right and I am wrong … Just this simple.
Have a nice time and make each next day the best one in your life!

1 Like

You can’t see what was deleted … and maybe it is good that you can’t … at least the admins here removed my posts which get flagged for being to alienating …

Nothing lisp specific, but that’s basically a struct/object for encapsulating data.

1 Like
  1. Imagine you have a really big codebase. When writing code, how would you disambiguate between “this” variable and “that” one with the same name? Even if your editor has to fill in the UUIDs, how would you instruct your editor?

  2. This big codebase might even span all the code ever written! How do you prevent name collisions / help resolution? If you decide to split the big codebase into smaller programs, you’re basically inventing namespacing.

  3. Why are names not enough to disambiguate between all the people in the world? How much further complexity do bureaucracies have to put up with, to tackle this?

  4. Most of the time, when I tell you something about “Tom” it’s quite clear which “Tom” we’re discussing. Programming languages should also be able to do the same (to a good approximation) – AI/reasoning is developing well enough to make this quite feasible soon. But the programmer will still need to help the editor/runtime disambiguate.

Nobody likes to be censored, but given the history, it’s not reasonable to take you at your word that it’s because of unconvincing evidence. Evidence also shouldn’t be stored on moderated forums. You can document and implement a programming language with all the characteristics and features you want in an independent repository entirely under your control; many services like Github also will not scrutinize you closely except for extreme circumstances. Then, demonstrate your language is at least as powerful and performant as other languages by writing programs and benchmarks that anyone can reproduce given your code. That is a proof of concept; everything you wrote or linked so far only amounted to speculation, and it’s not reasonable to expect anyone to be convinced by that.

I am glad you are asking … this is the first step on the path to understanding how would the world look like if it were another one? I sure don’t know the best possible answer to this question, but if you start to look for it you will maybe find yourself a much better one as the following idea of mine:

If you have a very big project … and have no other chance as to give each set of values a unique name … then … then you start with writing “documentation” of the requirements and of the outcomes describing in detail the meaning of each of the value sets the program will use just as sentences in plain English. You have to do it anyway to document the code, right? After you have written the documentation you have already unique names for each set of variables: the sentence/sentences you have used to describe their meanings. Now you can enumerate these sentences, or create a set of abbreviations, or … or … or … or you just stay with it … because you can put the descriptive sentences into the documentation of further parts of the project if it grows as they are and … you are done. You are done because you have marked all of the sentences as representing sets of or single values so now they serve as “long names” of variables. In other words, if you are done with writing the documentation in this clever way … you have already written the code … and now need only to parse and compile it. The documentation is then at the same time the code … so you are ready with the programming, right? No need for a programming language … What you need are some guidelines how to orchestrate it all so that it is possible to parse and compile it … The LLMs … reading the documentation will be then able to write the actual code for you in any programming language of your choice. This assumes that you have written the documentation in a precise and well formulated and unambiguous way, You may also use an oOo compiler designed to compile the in the oOo way written documentation to machine code … Is there still something unclear to you? Any hints why this can’t for sure be done as described?

You haven’t got the core of the idea behind oOo … I don’t want one more language … there are enough languages there … so one more is not the way … The way is to learn to speak English … in a way able to precise communicate what needs to be done. And the way is to take the responsibility for the function of the system yourself … without relying on tools others provide you with.

In other words the way you approach the understanding of what oOo is about prevents you from understanding what it is about … This is what is so revolutionary about oOo … you need to leave the deep ingrained paths of thoughts, let go of the past and become open to what is possible without restricting yourself to keeping all of the confusing trash you have inherited by learning to write programs is some language in the past preventing you to progress to a new, much higher level. English is enough … it is anyway the only way to describe the software and to exchange ideas on programming with others not proficient in the current programming language of your choice. Thinking in terms of a “better language” is the opposite way compared to the oOo way …

The concept of using a natural language, in particular English, to instruct a computer is not revolutionary at all, from its inception in science fiction to today’s virtual assistants and LLMs. Early programming languages had English-like syntax, but languages collectively moved away from that because English is known to be contextually ambiguous and mutating. Natural language processing is better than ever, yet generated code is inconsistent and unpredictably erroneous. Nobody wants these characteristics in a compiler.

If you implement your vision of a documentation compiler and share your product for others to confirm, then that would be revolutionary. That’s the only thing that can possibly convince anyone, anything else you do is wasted effort and evidently counterproductive.