Live data from Hacker News

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

github.com

61–70 of 82 posts

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

#61
post #37
post #31

Earlier quoted context omitted.

on Windows you can simply type `Windows key` + `.` and easily find it there, tho if languages use such characters they really should also have alternatives

that only opens the emoji picker, not a generic unicode picker.

It has Emoji, old school smileys and Symbols where you can actually find stuff like the lambda symbol (at least in Windows ver 1903)

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

#62
post #24
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…

Because people in non-English-speaking countries are perfectly within their rights to name source code entities in their native language instead of either having to mangle words into ASCII representations (possibly even leading to ambiguities in case of near-homonyms that have identical ASCII bastardizations!) or being forced to awkwardly translate domain terminology into English which is a task that may be any of th…

I'm not disagreeing with you because sometimes it's just project requirements - but as a developer in a non-English-speaking country - the idea of writing code in a non-English language is ridiculous to me.

Programming languages and standard libraries are written in English, programming terminology is invented in English, the international community adopted english as a defacto standard, almost all third party APIs expose English interfaces.

Every time I've seen a project written in my native language it's been ridiculously hard to follow because the terminology is translated in various ways (there's no official or even widely used terms because hardly anyone uses native language in SW development and CS outside of academia) and it's a mish mash between languages since everything not written in the project (along with language keywords) is written in English.

I don't usually take a hardline stances on things but this is one thing where it would be 100% a dealbreaker for working on a project.

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

#64

Amazing, 46 comments, all about my choosing to use the correct symbol for the macro. It's not like I choose some super misleading Unicode characters, like for example, how macOS smart quotes might change "foo" into “foo”. Again, technically correct... maybe programming languages should match these kinds of quotes too. But this is all more or less beside the point. I can type `λ!{x.x}` easily, since I have a Greek key…

P.S. DrRacket (https://racket-lang.org/) let's you insert a `λ` with Ctrl+\.

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

#65
If you want to play with this, you can run `cargo run` from this: https://github.com/nixpulvis/lambash/ repository.

It currently does both with and without η-reduction, and generally should work similarly to http://lambda.jimpryor.net/code/lambda_evaluator/ a very cool online JS lambda evaluator.

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

#66
post #28
post #26

Earlier quoted context omitted.

Sure, everybody has 'rights' but if I were to come across a workplace in my country where programmers were using much of our native language in the code I would consider it a red flag and I would expect to find amateurish practices in other places as well. The thing is that English is the lingua franca of programming and that ASCII is the lingua franca of source files. The highest quality manual that you are going to…

Sure, you could consider it unprofessional, but I'd wager that the large majority of all professional programming is done in languages other than English. The tooling issue is an "is vs. ought" problem. In 2019 full UTF-8 compatibility is not a feature anymore; on the contrary, a lack of support is a bug.

Do you have any citation on that ? From what I know the vast majority of all professional programming is done in English. Even companies like SAP that had a lot of programming in German have shifted to programming in English.

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

#67
post #52

Earlier quoted context omitted.

ASCII is typeable by everyone. I'm german. I know how to type äöüß they are native keys on my keyboard. I know how to type \lambda in LaTex. I don't know how to get the λ key. However, I can type ASCII. A russian knows how to type cyrillic letters, and while very likely also knowing their way around ASCII, probably can't type λ easily either. Like it or not, ASCII is the least common denominator. There is nothing gai…

You don't think λ-calculus deserves the symbol `λ!` in Rust? Anyone who is learning or interested in λ-calculus should be aware of what it means (that's the whole point). I generally agree we should all be so fortunate as to be able to read the code put in front of us. And you clearly know how to type a λ, you did it 6 times in your post.

[deleted]

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

#68
post #11

Earlier quoted context omitted.

I disagree. I looked through the source code to Principia a while back, and it makes really effective use of Greek script, black-letter script, math symbols, etc for implementing a physics engine. (It's a mod for Kerbal Space Program that implements n-body gravitation.) It's really well written and used just enough to make things more understandable. (They've got a great units system too; it's worth reading the code…

>Here's a random selection: https://github.com/mockingbirdnest/Principia/blob/master/phy... I don't think r² as a variable name is a good idea. It may look natural for some (including myself), but for others it implies a function while not being one.

Interesting... r² could be viewed as both an identifier and an operation.

    r² = r^2;
    A = πr²

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

#69
post #35

Earlier quoted context omitted.

A dedicated global compose key solves this problem very elegantly. Hitting the ◆ compose key (right alt for me) followed by a series of intuitive characters inserts the corresponding character. For example: ◆ - - - produces an em dash (—) ◆ - - . produces an en dash (–) ◆ ' e produces é ◆ | c produces the cent symbol (¢) Usually, you can just guess the combination and be right 3/4 times. Otherwise, it's fairly easy t…

macOS has something very similar with the option key, but the set of characters doesn’t include all Greek letters which is incredibly annoying: https://sites.psu.edu/symbolcodes/mac/codemac/

Except most of the key combinations are not intuitive. I could never guess them like I could with a compose key.

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

#70
post #13

looking forward to the first homograph attack in rust

Hmm. What would you attack? That is, if you were writing a crate that I was thinking of using in my program, how would homographs allow you to compromise my code?

The best attack is of an alias of a popular crate. Duplicate the functionality/behavior/version number but include a subtle backdoor.
Post reply on HN