3 ms·
The biggest one I would say is "context". It would be nice to avoid repetition in a controlled manner by having some context. This would make it less tedious
by borplk 9y ago
The biggest one I would say is "context".
It would be nice to avoid repetition in a controlled manner by having some context.
This would make it less tedious having to pass the same arguments to a function over and over again. For example let's say in a web application once you authenticate the user.
In the code that follows you could somehow tell it "by 'user' we mean the current user, by 'query' we mean query the database using the current database connection".
Effectively this would be similar to a transparent auto-wired dependency injection.
The biggest mismatch between human and computer langauges is that we as humans are very context aware.
And the computers are at the other end of the spectrum. Between two different function calls they don't remember or assume anything so we have to keep repeatedly passing stuff to them, what's obvious to us. Which itself increases the bugs because it's a lot easier to make a mistake when you are doing something repetitive 50 times, as opposed to declaring it right once somewhere.
Other useful ones could be having some expressions that are not strictly binary or function calls.
And the ability to define these for custom types.
For example "user is administrator", "1001 (is|is not) palindrome", "100 is divisible by at least 2 of [1, 10, 50]".
Another one, accessing attributes/fields, "firstName of user", "factors of 100", "favoritePosts of user".
Tests about attributes/fields, "if user has twoFactorAuthentication".
Another one, more "space freindly" languages. So you could do "let the thing we are printing := 'test';".
Now let me say I'm fully aware most of what I have said is very difficult if not impossible.
The problem is language complexity and parsing and also composition. The examples I have made don't really hold up in general cases or compose well so it's hard to fit them in general purpose languages.
If we were using projectional structure editors they would be much much easier to achieve. Because we wouldn't have to deal with language rules like that. You could render the program structure in a human friendly way without forcing the computer to parse and understand the same thing.
One of the biggest bottlenecks with programming languages today is that humans and computers are sharing a text based language with each other. And as a result we have to compromise on it to achieve a balance where it's easy enough for the computer to parse and understand and easy enough for humans to read and write.
If we could separate the two we could optimise the languages for ourselves and let the computers use something much more precise and unambigious like binary under the hood that makes them happy.
All much easier said than done.
- mabynogy 9y agoI think it's the default context that makes bash powerful (like the cwd).
- wolfgang42 9y ago> a transparent auto-wired dependency injection. I think you're looking for dynamic scopes. These are annoying for most programming, since you can't just look around nearby the way you can with lexical scopes, you have to figure out what the call stack for the function would look like. When used well, however, they can simplify things considerably. UNIX environment variables and stdin/stdout/stderr are dynamically scoped. Common Lisp seems to call these 'special variables' and has an "earmuff" convention of putting asterisks around their name to set them off.
- kazinator 9y ago> I think you're looking for dynamic scopes. Thanks for writing the comment I now don't have to.
- OtterCoder 9y ago> context Oh, please no. I've had to play fixer to too many codebases that used interesting tricks to implicitly import code, without pointing to a source. Trying to suss out the origin of a specific function named 'get' in a 100k line application, in a file that invokes, but never declares it, is an exercise in frustration. Less context, please, more explicitness.
- borplk 9y agoI was imagining it in a wish list futuristic next generation way that is safe and controlled. Not just "throw implicit/global stuff on the wall". We already know how to do that.