News for hackers. Stuff that matters.
Re:Rust, Macros, λ-calculus/Church numerals, oh my by db48x on Saturday June 08, 2019 @01:55AM (#20130869)
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 just for that.) Here's a random selection: https://github.com/mockingbirdnest/Principia/blob/master/phy...

Like anything else, it can certainly be misused. That doesn't mean it's never worth using though.

Re:Rust, Macros, λ-calculus/Church numerals, oh my by whatshisface on Saturday June 08, 2019 @02:21AM (#20130950)
Greek letters are good for transcribing equations that were written with Greek letters. The equations were written like that because you only get one letter per variable and you need more than 26 variables across multiple equations, which you want to be consistent. You only get one letter per variable because on paper you write down each equation about fifty times as you work with it, so it's kept short as much as possible.

Unless you speak Greek, I can't think of any other reasons for Greek letters to wander in to code.

Re:Rust, Macros, λ-calculus/Church numerals, oh my by littlestymaar on Saturday June 08, 2019 @04:45AM (#20131347)
But because you learn physics and maths on paper, you learn the equations this way. And once you've spent 10 years practicing physics with Greek letters, it's really annoying to be forced out of it when you program.
Re:Rust, Macros, λ-calculus/Church numerals, oh my by jimmy_dean on Saturday June 08, 2019 @02:51AM (#20131022)
100% this. To understand code written with Greek letters you'd also need to understand the author's intentions for using said letters. Is mu an average or coeff of friction? Why should I lean on a crutch of context for a casual skim of code? It doesn't help readability and it surely isn't enjoyable to write.
Re:Rust, Macros, λ-calculus/Church numerals, oh my by krapht on Saturday June 08, 2019 @05:31AM (#20131489)
It all depends on context. Short identifiers absolutely help readability. I feel like some people absolutely go too far with overly verbose variable names, especially in Java or C#.

Notation matters. What if I told you that to add two numbers you had to write it out as plus(number, number)? Clearly you'd riot. The reason people complain about short IDs is because they're not used to it, but there are a lot of domains (math, science) where using traditional notation enhances understanding. Hell, even in programming if someone wrote sequenceIndex instead of i when iterating over the indices of an array I'd think they were trying to troll.

Re:Rust, Macros, λ-calculus/Church numerals, oh my by celrod on Saturday June 08, 2019 @07:13AM (#20131794)
Aditionaly, in statistics Greek letters denote parameters, while the modern Latin alphabet we all use today is for variables. The data `x` has a normal(mu, Sigma) distribution, for example.

These sorts of conventions enhance readability by providing extra information. You know instantly that `y` must be data, while `theta` is a parameter.

Re:Rust, Macros, λ-calculus/Church numerals, oh my by nixpulvis on Saturday June 08, 2019 @12:13PM (#20133178)
I thought Racket (starting with BSL) to incoming freshman at Northeastern University, and they would nearly riot every year when we tell them it's `(+ 1 1)` for the next 4 months (at least).
Re:Rust, Macros, λ-calculus/Church numerals, oh my by db48x on Saturday June 08, 2019 @03:11PM (#20134417)
If it's hard to write then you can just improve your editor; there are lots of ways to do that, and most of them involve improving the software rather than hardware. Having a lousy editor is no excuse!
Re:Rust, Macros, λ-calculus/Church numerals, oh my by orbital-decay on Saturday June 08, 2019 @02:41AM (#20130997)
>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.

Re:Rust, Macros, λ-calculus/Church numerals, oh my by nixpulvis on Saturday June 08, 2019 @10:56AM (#20132695)
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 by db48x on Saturday June 08, 2019 @03:06PM (#20134380)
Yea, that's fair; it's definitely one of the more surprising things that they do. On the other hand, it's pretty common to pass around squared values that the math says that you ought to have taken the root of, when you know how long it takes to do that root. You're going to end up with some kind of convention for it, so it might as well be a short one.
Re:Rust, Macros, λ-calculus/Church numerals, oh my by fluffything on Saturday June 08, 2019 @07:23AM (#20131831)
I don't see how r² is worse than r2 or r_2 or r_to_the_power_of_two..