Live data from Hacker News

What do you call this in Ruby?

github.com

61–69 of 69 posts

Re: What do you call this in Ruby?

#62
post #53

Meanwhile: Mathematica 10.0 for Mac OS X x86 (64-bit) Copyright 1988-2014 Wolfram Research, Inc. In[1]:= FullForm[x->y*z^w] Out[1]//FullForm= Rule[x, Times[y, Power[z, w]]] In[2]:= x\[UnionPlus]y\[RightTee]z Out[2]= x ⊎ y ⊢ z There's no reason your programming language shouldn't be able to tell you what these things are called in English without an external reference.

Some operators are so abstract that they don't really have a good name. Eg if you are talking about groups in general, how do you pronounce the group operation ∘? At uni, we usually just called it Kringel.

The name can be arbitrary, as long as it's unambiguous. By the way, here's what mathematica says when I copy paste that and enter x∘y: SmallCircle[x,y]

Also fun:

    In[3]:= SpokenString[x\[SmallCircle]y]
    Out[3]= "SmallCircle of x and y"
Which can be turned in to sound:

    Speak[x\[SmallCircle]y]

Re: What do you call this in Ruby?

#63
post #32

Earlier quoted context omitted.

We Google them, which is an impossible task for non-alphabetic symbols. :P

I wonder at what point people started to expect that search engines can instantly provide all the answers to everything worth knowing. The correct place to find a word you don't know is a dictionary. The correct place to find a symbol in code that you don't know is the definition in the source code (or language reference if it's baked in), or simply ask someone who knows.

Asking someone you know is not an approach that scales in the large, and suggesting that all answers can be divined from source both assumes a level of mastery that cannot be expected (e.g. the difficulty of reading the source of C++'s Boost library vs. reaching for the extensive documentation) and denies the existence of questions such as "when is it appropriate to use this operator?" or "what is the worst-case runtime complexity of this operation?"

Re: What do you call this in Ruby?

#64
post #53

Earlier quoted context omitted.

Some operators are so abstract that they don't really have a good name. Eg if you are talking about groups in general, how do you pronounce the group operation ∘? At uni, we usually just called it Kringel.

The name can be arbitrary, as long as it's unambiguous. By the way, here's what mathematica says when I copy paste that and enter x∘y: SmallCircle[x,y] Also fun: In[3]:= SpokenString[x\[SmallCircle]y] Out[3]= "SmallCircle of x and y" Which can be turned in to sound: Speak[x\[SmallCircle]y]

Actually, it's not even unambiguous. In some sense, it's like an unbounded variable.

Re: What do you call this in Ruby?

#65
post #58

Earlier quoted context omitted.

Sperm comes from ejaculate. Ejaculation is a bodily function. Bodily function is likely not going to be proper in a professional environment.

Really? What about sleep/wake?

Specifically, sex makes many people uncomfortable. Sure, it's natural function but it's not a topic many people are comfortable talking about openly. Not me but you can understand how this would be a sensitive enough topic for enough people that they'd leave it out, no?

Re: What do you call this in Ruby?

#66

Earlier quoted context omitted.

We're specifically talking about operators and finding a way to determine if they are universally known. If the wording bothers you, replace it with "We should only accept symbolic operators that are taught up to sixth grade".

Also prohibited: == (children learn =), &&, ||, |, ^, %, ++, --, != (children learn ≠), ~, >. & is maybe allowed. Sixth graders don't know about bitwise operations, but they know & means "and". That's stretching things a bit, though. Is [] allowed for indexing? When I learned about arrays in sixth grade... No, wait, I didn't learn about arrays in sixth grade. For that matter, I didn't learn about functions using ():…

The benefit is limiting the cognitive overhead of a language. The translation you describe is a task that must be done every single time by every single person who works with the code. Especially when discussing the code with another person, you end up reading things out loud. Every single time I encounter a bit of ascii-art code, I have to rack my brain for "in this context, what is the word that this symbol translates to". It gets especially bad if you work in multiple languages.

Also, I despise the logic of "because it exists on a keyboard, it should be used". C is a terrible offender in this regard, with * and & used for no good reason.

10-years-old, or 6th grade, or whatever is an arbitrary number, but don't get caught up in the distinction. "90% of high school graduates" would institute a similar threshold, and probably be less controversial.

Re: What do you call this in Ruby?

#67
post #38
post #6

This sums up what I dislike most about Scala (which is an even worse offender in this regard). A rule of thumb: if a 10-year-old wouldn't be able to intuitively read the operator, use words.

Pfft try Haskell sometime. Everything that's even remotely Applicative seems to have a tendency to export 20 variations of . Then there's Lenses, the coolest line noise you'll ever see.

Yep. Haskellians invaded the early Scala community, crapping on codebases everywhere.

Re: What do you call this in Ruby?

#68
post #51
post #6

This sums up what I dislike most about Scala (which is an even worse offender in this regard). A rule of thumb: if a 10-year-old wouldn't be able to intuitively read the operator, use words.

People say that. But it's totally misguided IME. You're talking about scalaz. Normal Scala code has fewer symbols than Ruby aside from function lifting (the underscore). In fact, you've got Generics (square braces), curly braces for blocks, fatty arrows for call-by-name, functions parameters and pattern matching. Parens for methods and tuples. Underscore for function lifting. cons (double or triple colon). Stab by ar…

The problem is that having Scalaz and its ilk underpinning a lot of libraries mean that, if you need to go down the debugging stack, you find yourself pretty quickly in squiggle soup.

Re: What do you call this in Ruby?

#69
post #68
post #51

Earlier quoted context omitted.

People say that. But it's totally misguided IME. You're talking about scalaz. Normal Scala code has fewer symbols than Ruby aside from function lifting (the underscore). In fact, you've got Generics (square braces), curly braces for blocks, fatty arrows for call-by-name, functions parameters and pattern matching. Parens for methods and tuples. Underscore for function lifting. cons (double or triple colon). Stab by ar…

The problem is that having Scalaz and its ilk underpinning a lot of libraries mean that, if you need to go down the debugging stack, you find yourself pretty quickly in squiggle soup.

> a lot of libraries

Then I'd go back to the issue of: You might be using the wrong libraries if you find that frustrating.

I don't think any of the libraries I'm using in my current project utilize any typelevel stuff to a noticeable extent. I have seen it in my classpath, but haven't bothered to see where it's coming from and never run into any of it despite using CMD+B very frequently in IDEA.

You can go a pretty long ways with Scalatest, Akka, json4s, and maybe some commons stuff for REST service development. Play development isn't all that much different though.

If you're deep in science, maybe your library needs change. But then again I would assume less complaint over mathy concepts then. Maybe that's off-base.

Post reply on HN