justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.


Name: Ask: Human (enter yes):
[back to index] | [unreplied] | [replied] | [recent comments] | [all]

Question: When I read the question about local variables, I wonder: why is global variables the default in many(all?) languages, despite its problems? Why not having programming languages specify, that a variable shall be purposely global instead? (probably a philosophical question)..
Asked by Mespotine (37.4.251.x) on October 17 2025, 2:22pm
Reply on October 17 2025, 2:54pm (edited at October 17 2025, 2:56pm):
    Many languages require you to declare variables, those typically don't have this issue. While I can't answer why it happens in general, in EEL2, it was the path of least resistance when adding function support... but in hindsight, stupid laziness. I suppose a mode in EEL2 which would be local_default() could be useful, so that you only have to declare globals, and not locals. but that would be more error prone. I guess local() and global() it is!


Comments:
  • Posted by Mespotine (37.4.251.x) on October 17 2025, 4:00pm:
    Thnx :)


Comment:
    Your Name:   -- Site Owner's Name:  (for human-verification)

    Comment:    

    
  
[back to index] | [unreplied] | [replied] | [recent comments] | [all]
Copyright 2025 Justin Frankel. | RSS