On Wednesday, June 13, 2018 at 2:08:51 PM UTC+2, stefan wrote:
> I think, there is general agreement that barewords for operators were not necessarily a good idea (see also the discussion in TIP #461), but there is also a shared understanding that the built-in expr-sublanguage will remain stuck with barewords for a while (and a "while" in the Tcl-verse counts decades, empirically), won't it?
On Tuesday, June 5, 2018 at 9:51:58 AM UTC+2, Andreas Otto wrote:
> example: the logical operator *= and ~= in "expr" (!*= !~= is the reverse)
Not using letters for operators would yield weird assemblies of special characters for operators.
> I am not sure that adding an additional piece of unconditional substitution will help here, but rather add to the confusion, as long as there are just barewords (true, false, t, f, ...):
Haha, I didn't know all of them: 0, false, no, or off; 1, true, yes, or on (Tcl_GetBoolean)
> What is the expected outcome under your suggestion for the above example?
The real example that triggered my idea was [::math::constants::constants pi].
expr sin($pi) ;# 1.2246467991473532e-16(sic!)
expr sin(pi) ;# would be nice
On Thursday, June 14, 2018 at 12:45:06 AM UTC+2, Mike Griffiths wrote:
> This has the potential to create horrible bugs, especially since there are already "eq" and "ne" operators. Is:
>
> expr {ne}
>
> Checking of the variable $ne contains a true value? Or is it missing the two values to compare?
>
> Is:
>
> expr {ne foo}
>
> missing the first value (to compare to $foo), or is it trying to compare $ne and $foo in some way but missing the operator?
>
> You could special-case "eq" and "ne" so they are always assumed to be operators, but that kind of special treatment is a) horrible, and b) not at all forwards-compatible, because you're preventing yourself from ever being able to add new operators in a backwards-compatible manner.
>
> A lot of potential pitfalls for extremely little gain, IMHO.
I see the point.
My intention was to get rid of the rather useless error "invalid bareword". Disregarding that they share the namespace with operators, I first thought that it would great to interpret them as strings (like all Tcl words).
This conversation was about variable names instead of strings. Again, just in case of no other possible interpretation; I like the term "unknown barewords" by Stefan!
Redirecting the lexer's output was simple; other ideas would require more code changes...
Thanks anyway for sharing your thoughts.
Regards
Martin