In 'A' => 1 , 'A' is a string, in A => 1 A is an identifier.
Relevant discussion ...
If the key is a syntactic identifier, and it is directly in the argument list, it will be accepted as a named argument. Otherwise it will be a couple
"foo" => "bar" is not a syntactic identifier, (foo => "bar") is not directly in the argument list, nor is (: foo)
foo => "bar" and: foo ("bar") are equivalent, and both have a key that is a syntactic identifier
Q: Does identifier do "ident" => "foo" outside the argument list?
This is the wrong way. They are always pairs, which means that they move along named arguments when at the top level of the argument list
Q: and does: 2 <> and: 2nd do not turn into pairs for convenience only?
: 2nd is just: nd (2)
Q: why not "2nd" => "True"? because not an identifier?
Also because it is not very useful. Imagine that you are trying to implement s: 2nd / foo / bar / You should take a dirty hash and try to parse the number from it
Q: if the thing after: can only be an identifier in the base case, then everything is fine and good at doing things with non-identifiers.
Yes, something non-identifier after it is a special form
source share