New idea: importable operators

Since the feature freeze is coming up… (a trivial restricted/easy to implement pre-support should be possible).

I have two possible uses for importable operators.

a)

Instead of A’ to transpose a matrix, Aᵀ was proposed (in Github issue) as an alternative.

The proposal failed since there are some other uses for that ᵀ (as part of variable names?), and there’s already an ASCII operator.

Would it be possible to implement it in the parser FemptoLisp/Scheme code, and minimally and have it dormant? I mean the ᵀ would parse as any other ASCII letter (or whatever is done now; as a parse error).

But for those who want the accepted math syntax they could somehow import the operator [for a module or a file], and get the transpose. Or maybe could get to define the purpose?

b)

and and or where proposed as synonyms or replacement for && and or. These are strictly for [short-circuiting] control flow, not just operators.

The proposal failed, and I had a counterproposal where they are defined as non-short-cicuiting. Long store, not going to argue pros and cons here…

But can they at least be defined in the parser, just to get an syntax error? Yes, that’s strictly a breaking change, but would/is already(?) be using those as variable names…

If we want to define them post-1.0 then it will of course be a breaking change that we want to wait with for at least one year for 2.0, because of no-break promise in 1.0?

Even if we only define the operators as “illegal keywords” is it a valuable idea? We can then later define them in 1.0.x as something specific, or implement the importable idea.

There’s already in NEWS something similar:

Custom infix operators can now be defined by appending Unicode combining marks, primes, and sub/superscripts to other operators. For example, +̂ₐ″ is parsed as an infix operator with the same precedence as + (#22089).

And I see this thread:

Try this:

https://github.com/Ismael-VC/InfixFunctions.jl

That along with #22089 probably covers enough ground.

1 Like