You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #22089 it is possible to add suffixes to existing binary operators in order to create entirely new ones.
If it were possible to add suffixes to the postfix ' operator as well, then that would make it possible for the user to create an arbitrary number of new postfix operators. For example, it would make it possible to make A'ᵀ the transpose of A.
See JuliaLang/LinearAlgebra.jl#410 for the beginning of this discussion. Here's a brief summary as best as I've understood: The original proposal was to map x' to the function call '(x), and then allow suffixes on that function name, but this is not possible. The first character of an identifier cannot be ', because ' is already used to introduce character literals. On the other hand, using a function name like apostrophe can lead to problems similar to #25947. That problem can be avoided by mapping to Base.apostrophe instead of using the local scope.
The text was updated successfully, but these errors were encountered:
I believe that it would be possible to shoehorn in a ' identifier by allowing it
in contexts where a character literal is not allowed. The most important
use cases: function ', import ', and export ' would work, because a
character literal cannot follow those keywords.
In other contexts, one would need something convoluted like eval(Symbol("'")).
For example, the Base module might have const apostrophe = eval(Symbol("'")),
so that Base.apostrophe(::Foo) = bar, would be equivalent to import Base: '; function '(::Foo); bar; end'.
But these would be rare cases, that normal users need not worry about.
Since #22089 it is possible to add suffixes to existing binary operators in order to create entirely new ones.
If it were possible to add suffixes to the postfix
'
operator as well, then that would make it possible for the user to create an arbitrary number of new postfix operators. For example, it would make it possible to makeA'ᵀ
the transpose ofA
.See JuliaLang/LinearAlgebra.jl#410 for the beginning of this discussion. Here's a brief summary as best as I've understood: The original proposal was to map
x'
to the function call'(x)
, and then allow suffixes on that function name, but this is not possible. The first character of an identifier cannot be'
, because'
is already used to introduce character literals. On the other hand, using a function name likeapostrophe
can lead to problems similar to #25947. That problem can be avoided by mapping toBase.apostrophe
instead of using the local scope.The text was updated successfully, but these errors were encountered: