Live data from Hacker News

Rust, Macros, λ-calculus/Church numerals, oh my

github.com

1–10 of 82 posts

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#2
While it's definitely cute and amusing, this is exactly why languages that specify their source code in non-ascii encodings are a bad idea. Fully 92.6% of working programmers have no idea how to produce a λ or γ on their input device of choice. Maybe a third of those could eventually find it with a character picker tool.

Java started this (in the unicode era anyway -- yeah yeah, APL). The community quite sanely rejected it as a matter of style. I have no idea why it hasn't been killed dead in new designs.

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#3
post #2

While it's definitely cute and amusing, this is exactly why languages that specify their source code in non-ascii encodings are a bad idea. Fully 92.6% of working programmers have no idea how to produce a λ or γ on their input device of choice. Maybe a third of those could eventually find it with a character picker tool. Java started this (in the unicode era anyway -- yeah yeah, APL). The community quite sanely rejec…

Sure but this is a macro that’s user defined and not in the rust source code. Here’s the macro def:

https://github.com/nixpulvis/lalrpop-lambda/blob/master/src/...

I think it’s important to allow Unicode for developers to be more inclusive of other languages and cultures. This is at the forefront of the community of Rust.

As for keywords, yes, I’m with you there.

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#4
post #2

While it's definitely cute and amusing, this is exactly why languages that specify their source code in non-ascii encodings are a bad idea. Fully 92.6% of working programmers have no idea how to produce a λ or γ on their input device of choice. Maybe a third of those could eventually find it with a character picker tool. Java started this (in the unicode era anyway -- yeah yeah, APL). The community quite sanely rejec…

Maybe it’s time for a plugin that does this (or maybe it already exists?):

You press the backslash key, enter the name of the symbol, then press enter, and the symbol will show up in your buffer.

Something like:

\lambda -> λ

\Lambda -> Λ

\\ -> \

et cetra.

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#5
post #2

While it's definitely cute and amusing, this is exactly why languages that specify their source code in non-ascii encodings are a bad idea. Fully 92.6% of working programmers have no idea how to produce a λ or γ on their input device of choice. Maybe a third of those could eventually find it with a character picker tool. Java started this (in the unicode era anyway -- yeah yeah, APL). The community quite sanely rejec…

> this is exactly why languages that specify their source code in non-ascii encodings are a bad idea.

Seems like your problem isn't that the source has a specified encoding, but that the syntax allows for non-ascii characters in identifiers, which is actually an unstable feature of Rust, only available with nightly compiler builds. See the feature flag: https://github.com/nixpulvis/lalrpop-lambda/blob/master/src/...

Specifying ASCII for the source code, as your post suggests is better, would leave everyone stuck using \uxxxx escapes for non-ASCII data in string literals. That's unnecessary when you instead specify UTF-8.

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#6
post #2

While it's definitely cute and amusing, this is exactly why languages that specify their source code in non-ascii encodings are a bad idea. Fully 92.6% of working programmers have no idea how to produce a λ or γ on their input device of choice. Maybe a third of those could eventually find it with a character picker tool. Java started this (in the unicode era anyway -- yeah yeah, APL). The community quite sanely rejec…

I like to look at it from a different perspective:

Programming has mostly looked the same since we moved away from punchcards, and it seems worthwhile exploring different approaches (eg visual programming) and augmentations to the existing system. Now that we have UTF-8, it's trivial to represent all sorts of characters and use them for coding, and it's only natural that some people try.

Now, while I personally haven't seen a convincing application of using non-ascii beyond comments, that doesn't mean they don't exist. And if people come up with such a way, and a large number of people decide it's a good idea, then tooling in whatever form will follow and make using this new style of coding easy.

I feel like arguing that this should never be done because people don't know where to find the symbols is a bit like arguing we shouldn't build electric vehicles because we don't have a charger network on highways yet..

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#7
post #2

While it's definitely cute and amusing, this is exactly why languages that specify their source code in non-ascii encodings are a bad idea. Fully 92.6% of working programmers have no idea how to produce a λ or γ on their input device of choice. Maybe a third of those could eventually find it with a character picker tool. Java started this (in the unicode era anyway -- yeah yeah, APL). The community quite sanely rejec…

Maybe it’s time for a plugin that does this (or maybe it already exists?): You press the backslash key, enter the name of the symbol, then press enter, and the symbol will show up in your buffer. Something like: \lambda -> λ \Lambda -> Λ \\ -> \ et cetra.

https://github.com/JunoLab/atom-latex-completions is one that does this.

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#8
post #2

While it's definitely cute and amusing, this is exactly why languages that specify their source code in non-ascii encodings are a bad idea. Fully 92.6% of working programmers have no idea how to produce a λ or γ on their input device of choice. Maybe a third of those could eventually find it with a character picker tool. Java started this (in the unicode era anyway -- yeah yeah, APL). The community quite sanely rejec…

I've been clear to make things work just fine with `\` (parsed with LALRPOP), `abs!`, and `app!`.

I've only been pasting in a few in READMEs and standard constants for brevity.

Re: Rust, Macros, λ-calculus/Church numerals, oh my

#10

looking forward to the first homograph attack in rust

If you look at the Unicode identifiers RFC's discussion[2] you'll see the steps we're taking to address and mitigate that and other problems. That being said if you look at the tracking issue[3] you would also see that we haven't had the man power to fully implement this feature, which is why it will remain opt-in, nightly only for the medium term.

[1]: https://github.com/rust-lang/rfcs/blob/master/text/2457-non-...

[2]: https://github.com/rust-lang/rfcs/pull/2457

[3]: https://github.com/rust-lang/rust/issues/55467

Post reply on HN