The audacity to do such a thing…

You are viewing a single thread.
View all comments
45 points

The answer is writing a program that writes the variables dynamically to a file and including that file into the source file that uses them.

No need to thank me folks I’m just trying to make the world a better place.

permalink
report
reply
10 points

Or just use a dictionary/hashmap if it’s all in the same program

permalink
report
parent
reply
14 points

Or in JavaScript you can build a string that creates the name of a variable in a sub loop by concatenating ““variable”+$i” and passing that value into a variable that is then read as the name of an incremental variable that a value is then passed to.

This has the advantage of being both extremely unwieldy and highly inscrutable, and there’s a small chance it will make your coworkers send you death threats in slack.

permalink
report
parent
reply
5 points

JavaScript: They were so focused on whether or not they could that they forgot to consider whether or not they should

permalink
report
parent
reply
1 point

I once created a system to automatically load and execute arbitrary JS files and any exported functions in them as part of a server

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 3.7K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments