Over the weekend, I realised, extremely belatedly, that the expression language I designed for my free-software project
spigot has a grammar bug. Specifically, it's a context-dependency analogous to the C typedef bug: the same expression can parse differently depending on whether a given identifier is currently defined to be a function or a
(
Read more... )
Comments 4
Reply
But it also occurred to me, it should *look* obvious, I don't know if there are any heuristics you use in naming variables vs functions that could be promoted to a language requirement.
OTOH, I guess, function-call operator for ints could be defined to be multiply :)
Or, programmers could suck it up and figure out a way to use different sorts of bracket for "invoke function" from "collect expressions together" :)
Reply
And you manage to make it look like coincidence that you say this just below deborah_c's comment about Fortran! :-)
Or, programmers could suck it up and figure out a way to use different sorts of bracket for "invoke function" from "collect expressions together" :)
Oddly, I did have the weird thought some time last year that - at least for functions in the true mathematical sense, i.e. no side effects and always the same output for the same input - square brackets might be quite appropriate in a computing context.
Because, mathematically speaking, a function is a static collection of (input,output) pairs, i.e. it's basically the same as an array or dict/map/hash - better yet, an immutable one. So it should have the same syntax as an array lookup!
The fact that in programming the thing we call 'function' computes each result on demand whereas 'map' stores them all in advance is a mere implementation distinction ( ... )
Reply
Reply
Leave a comment