News for hackers. Stuff that matters.
Re:What do you call this in Ruby? by kbenson on Saturday March 26, 2016 @11:39PM (#11368771)
Such little imagination... You should learn from your forefathers. Quantity is no substitute for quality. ;)

http://search.cpan.org/dist/perlsecret/lib/perlsecret.pod#SY...

Re:What do you call this in Ruby? by Bluestrike2 on Sunday March 27, 2016 @12:30AM (#11368881)
It would seem like the forefathers won this round. You've got to love the inchworm on a stick.
Re:What do you call this in Ruby? by dward on Sunday March 27, 2016 @01:34AM (#11369039)

    =( )=  goatse operator
cannot unsee.
Re:What do you call this in Ruby? by brandonbloom on Sunday March 27, 2016 @12:22AM (#11368861)
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.
Re:What do you call this in Ruby? by Skywing on Sunday March 27, 2016 @01:07AM (#11368981)
Or is there? queue x-files theme song
Re:What do you call this in Ruby? by eru on Sunday March 27, 2016 @02:34AM (#11369128)
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.

Re:What do you call this in Ruby? by brandonbloom on Sunday March 27, 2016 @05:16PM (#11371603)
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? by eru on Sunday March 27, 2016 @11:22PM (#11372540)
Actually, it's not even unambiguous. In some sense, it's like an unbounded variable.
Re:What do you call this in Ruby? by pak on Saturday March 26, 2016 @11:08PM (#11368676)
Say what you will about us, but Ruby people get to have the most fun.

hops on hipster hashrocket and tribbles off into the sunset

Re:What do you call this in Ruby? by timdorr on Saturday March 26, 2016 @11:51PM (#11368796)
> Pythonists are all "explicit is better than implicit" and Rubists are all like "LOOK AT ME I MADE A BONG OUT OF THIS HAIR DRYER"

https://twitter.com/geeksam/status/618828713308753921

Re:What do you call this in Ruby? by zachrose on Sunday March 27, 2016 @12:54AM (#11368947)
"AND CHECK OUT THIS COOL WAY TO TEST IT"
Re:What do you call this in Ruby? by xiaq on Saturday March 26, 2016 @11:36PM (#11368759)
Perl hackers will disagree :)
Re:What do you call this in Ruby? by greglindahl on Sunday March 27, 2016 @12:01AM (#11368815)
There's something very special about a language that supports the goatse operator.
Re:What do you call this in Ruby? by ymse on Sunday March 27, 2016 @12:11AM (#11368842)
https://metacpan.org/pod/perlsecret#Goatse

That whole list is gold. My favourite so far is "space station": -+-

Re:What do you call this in Ruby? by technion on Saturday March 26, 2016 @11:22PM (#11368709)
I had a Microsoft support technician ask us to press the "flower button" in a powershell script. It took a while to work out he meant { and }.
Re:What do you call this in Ruby? by jowiar on Saturday March 26, 2016 @11:18PM (#11368696)
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.
Re:What do you call this in Ruby? by PeCaN on Sunday March 27, 2016 @12:53AM (#11368941)
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.

Re:What do you call this in Ruby? by jowiar on Monday March 28, 2016 @02:22PM (#11376176)
Yep. Haskellians invaded the early Scala community, crapping on codebases everywhere.
Re:What do you call this in Ruby? by ssmoot on Sunday March 27, 2016 @01:59AM (#11369077)
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 arrows as an optional shorthand infix notation for creating Pairs AKA Tuple2.

Every once in a blue moon you might see :+ to mean add a single item.

You can write a whole heckuva lot of Scala and never use much more than that. If you're facing symbolic overload then you should probably reevaluate the libraries you're using.

The only ones I use frequently that add anything else are spray-routing/akka-http's Route.~ to concatinate routes and json4s's JObject.~ to concatinate two objects together.

Yes there's a world of libraries that add a lot more, but they're entirely optional. You aren't a bad programmer if you do or do not use scalaz. (At least I don't consider myself a bad one, and I don't.)

Scala itself doesn't actually extend all that far beyond c#. The FUD around symbols in Scala is just that. You add cons, the occasional stabby arrow and the underscore and you've got the extent of Scala's additions you'll find in your average library.

I just do not get how people walk away with this impression. Especially Rubyists where ivars, cvars, pipe characters, two different HashMap styles etc is in everyday code.

IME Scala developers in-training don't actually have much trouble with this stuff. What they have trouble with is pattern-matching structure and function composition.

But Ruby can't do either.

In fact, other than the ability to invent more complex DSLs with more symbols I'm not actually sure that there's anything Ruby does better. Or more consistently.

Re:What do you call this in Ruby? by jowiar on Monday March 28, 2016 @02:24PM (#11376190)
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? by ssmoot on Tuesday March 29, 2016 @01:33PM (#11383167)
> 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.

Re:What do you call this in Ruby? by greydius on Saturday March 26, 2016 @11:23PM (#11368713)
Written words are symbols as well. What should we do when we don't understand words?
Re:What do you call this in Ruby? by incepted on Sunday March 27, 2016 @12:43AM (#11368913)
Slippery slope argument.

I like the Litmus test that a ten year old should be able to read them, which means that +, *, / and - are fine but =~> and other nonsense should be banned.

Re:What do you call this in Ruby? by greydius on Sunday March 27, 2016 @09:13AM (#11369857)
Most people who write software are not children. I certainly hold my doctor, accountant, mechanic, etc to a higher standard. Why should we expect software developers to be no better than children?
Re:What do you call this in Ruby? by incepted on Sunday March 27, 2016 @10:26AM (#11370038)
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".

Re:What do you call this in Ruby? by parenthephobia on Sunday March 27, 2016 @01:13PM (#11370631)
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 (): those are only for grouping expressions. Functions are just like, "sin 90". Also, since I didn't learn about code at sixth grade, I obviously didn't learn about using {} to delimit code blocks; , was only used in prose, not in mathematics.

Having said that, it's unclear why programming languages should be limited to operators that we can guarantee "sixth grade" students (whatever that happens to mean in your part of the world) will have heard of.

What actual benefit could it bring, other than (maybe) making it easier for somebody who hasn't learned a language to guess the meaning of a piece of code in that language? Is that benefit worth making code twice as long and rendering half the keyboard useless?

    main() {
      printf("hello, world\n");
    }
Should, I assume be:

    the main procedure is:
      the message is "hello, world" plus a new line;
      display the message;
      stop.
Anything else will be too confusing for the many sixth graders currently working professionally as programmers.
Re:What do you call this in Ruby? by jowiar on Monday March 28, 2016 @02:21PM (#11376168)
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? by kibwen on Sunday March 27, 2016 @12:24AM (#11368867)
We Google them, which is an impossible task for non-alphabetic symbols. :P
Re:What do you call this in Ruby? by greydius on Sunday March 27, 2016 @09:06AM (#11369834)
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.
Re:What do you call this in Ruby? by kibwen on Sunday March 27, 2016 @07:55PM (#11372027)
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? by patrickking on Sunday March 27, 2016 @01:34AM (#11369038)
Re:What do you call this in Ruby? by krotton on Sunday March 27, 2016 @03:27AM (#11369232)
SBT's the worst offender.
Re:What do you call this in Ruby? by zyxley on Sunday March 27, 2016 @01:09AM (#11368986)
This seems like it could have been prime territory for a bit of surrealist/meta fiction, with gradually stranger descriptions of operators turning into a short story of some kind.
Re:What do you call this in Ruby? by brightball on Saturday March 26, 2016 @11:01PM (#11368667)
I will be using bacon cannon from here on out
Re:What do you call this in Ruby? by teddyh on Saturday March 26, 2016 @11:50PM (#11368793)
Normal single-character operators also have names:

http://www.catb.org/jargon/html/A/ASCII.html

Re:What do you call this in Ruby? by biot on Sunday March 27, 2016 @12:05AM (#11368827)
How did hashrocket get named? I would think instead of => a hashrocket would look like: #>

edit: Makes total sense. Thanks for the replies.

Re:What do you call this in Ruby? by arjie on Sunday March 27, 2016 @12:23AM (#11368863)
Ruby's associative arrays are called hashes. That operator is how you assign a value to a key.
Re:What do you call this in Ruby? by Cerium on Sunday March 27, 2016 @12:23AM (#11368862)
I understand that it is the rocket shaped operator used in making hashes.

{:cats => "foo"}

Re:What do you call this in Ruby? by broodbucket on Saturday March 26, 2016 @11:24PM (#11368718)
Wish I worked with a language with a === operator so I could say "threequals". Very clever and fitting.
Re:What do you call this in Ruby? by BigJono on Saturday March 26, 2016 @11:32PM (#11368745)
I've worked with Javascript for years and never thought of this. Such wasted opportunity...
Re:What do you call this in Ruby? by eru on Saturday March 26, 2016 @11:26PM (#11368727)
A select few operators (out of hundreds) for a single Haskell library: https://github.com/ekmett/lens/wiki/Operators

(For full disclosure, the lens library is infamous for this.)

Re:What do you call this in Ruby? by kccqzy on Saturday March 26, 2016 @11:45PM (#11368779)
You are perfectly fine importing the module Control.Lens.Combinators[0], which has the full functionality of lens except the operators. There's nothing you can do with operators but can't do with normal functions named with words.

[0]: http://ekmett.github.io/lens/src/Control-Lens-Combinators.ht...

Re:What do you call this in Ruby? by eru on Sunday March 27, 2016 @02:30AM (#11369121)
Oh, definitely. Haskell approach to operators and overloading is exactly the Right Way: operators are weirdly syntaxed function, and you can add your own. No need to make bit-shifting do IO.
Re:What do you call this in Ruby? by jack9 on Sunday March 27, 2016 @12:34AM (#11368891)
... is an ellipsis.

! is enunciated as "bang" from BASH parlance, iirc.

Re:What do you call this in Ruby? by juanfatas on Sunday March 27, 2016 @12:39AM (#11368902)
thank you, added.
Re:What do you call this in Ruby? by mokus on Sunday March 27, 2016 @01:24AM (#11369018)
Looks like quite a few of these were cribbed from the intercal character set[0]. Nice to see that living on.

[0] http://www.muppetlabs.com/~breadbox/intercal-man/tonsila.htm...

Re:What do you call this in Ruby? by mifix on Saturday March 26, 2016 @11:09PM (#11368682)
Just added a PR for the spermy operator (~>).
Re:What do you call this in Ruby? by MichaelApproved on Saturday March 26, 2016 @11:26PM (#11368725)
For those wondering, here's the request: https://github.com/JuanitoFatas/what-do-you-call-this-in-rub...

Here's the response: Hi Christian, thanks for the Pull Request! But I think this is not appropriate rubygems/rubygems#124. :bow:

Re:What do you call this in Ruby? by mifix on Sunday March 27, 2016 @01:29AM (#11369030)
Can someone explain to me, why this is not appropriate?
Re:What do you call this in Ruby? by MichaelApproved on Sunday March 27, 2016 @05:05AM (#11369405)
Sperm comes from ejaculate. Ejaculation is a bodily function. Bodily function is likely not going to be proper in a professional environment.
Re:What do you call this in Ruby? by _lce0 on Sunday March 27, 2016 @10:08AM (#11369989)
Really? What about sleep/wake?
Re:What do you call this in Ruby? by MichaelApproved on Monday March 28, 2016 @12:41AM (#11372761)
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? by gregschlom on Sunday March 27, 2016 @12:07AM (#11368834)
my favorite is the "Elvis operator" in kotlin ?:

Took me a while to figure out why it was called that way.

Re:What do you call this in Ruby? by santaclaus on Saturday March 26, 2016 @11:30PM (#11368739)
> =~

Cigarette operator! This list is on fire.

Re:What do you call this in Ruby? by rosalinekarr on Saturday March 26, 2016 @11:07PM (#11368672)
I like to call crab clows 'insert.'
Re:What do you call this in Ruby? by juanfatas on Sunday March 27, 2016 @12:24AM (#11368866)
I added, thank you.
Re:What do you call this in Ruby? by cdcarter on Saturday March 26, 2016 @11:25PM (#11368723)
'!!' -> "truthy?"
Re:What do you call this in Ruby? by MichaelApproved on Saturday March 26, 2016 @11:29PM (#11368736)
! -> "not truthy". So !! means "not 'not truthy'" which is truthy.

Truthy is something that isn't exactly a true boolean but will equate to true(thy) when evaluated with this type of comparison. Things like undefined, null, and empty string will not be truthy.

More info on what's truthy (for JavaScript at least) is here http://james.padolsey.com/javascript/truthy-falsey/

edit: typically, if you want to test for truthy, you'll just evaluate it like so

if (my_object) { //truthy }else{ //not truthy }

Does anyone know a time when you'd use !! instead of just the object in the evaluation? I'm not a Ruby dev, so I don't know specific cases for needing !!

Re:What do you call this in Ruby? by Stratoscope on Sunday March 27, 2016 @01:17AM (#11369001)
One typical use for !! in JavaScript or Ruby is where a function/method returns a boolean value that indicates the presence or absence of an object.

You could just use:

  return myObject;
Since that value will be truthy or falsy, any code that tests it will generally work, as your if statement example demonstrates.

But there are two advantages to doing this instead:

  return !! myObject;
1) Now you are returning an actual boolean value, not just a truthy/falsy value.

2) Sometimes more importantly, you are now releasing this function's reference to the object, instead of possibly keeping that reference around much longer than needed and preventing it from being garbage collected.

Re:What do you call this in Ruby? by tinco on Sunday March 27, 2016 @12:04AM (#11368819)
Generally when you prepare a value for serialization. In my ~8 years of Ruby I've only used !! a few times. I think all those times had to do with configuration and/or serialization. For example:

```

    my_option = !!ENV[MY_OPTION] # is false when not set
    puts "my_option is: #{my_option}"
```
Re:What do you call this in Ruby? by cdcarter on Saturday March 26, 2016 @11:31PM (#11368741)
Yep, I thought it was a common enough idiom in Ruby as well that it might belong on the list!
Re:What do you call this in Ruby? by kbenson on Saturday March 26, 2016 @11:38PM (#11368765)
In other words, "cast to boolean"
Re:What do you call this in Ruby? by clairity on Sunday March 27, 2016 @03:01PM (#11371034)
i like the yoda operator: !!!

i've never used it... what's a good use case?

Re:What do you call this in Ruby? by dasil003 on Sunday March 27, 2016 @12:45AM (#11368922)
stabby lambda is my favorite.
Re:What do you call this in Ruby? by ilikepi on Sunday March 27, 2016 @01:36AM (#11369042)
I like the name "stabby lambda", but I dislike its use. It seems less readable to me. The again I also think ruby 1.9 Hash syntax is less readable, so maybe my judgement is suspect.
Re:What do you call this in Ruby? by Skywing on Sunday March 27, 2016 @01:04AM (#11368977)
dat bacon cannon