Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I guessed the issue by the first one given that I found it weird you were using the positive operator. I didn't know that ruby had non-paren invocations but I guessed that, if that were the case (seeing as how coffeescript had them and coffeescript was largely inspired by Ruby) then that would be happening lmfaoooooooo
Wow that must have been a headache. -
Root797754y@junon It didn’t take me long to figure it out, but longer than it should have.
I’m so burned out on this damned screwdriver I literally can’t focus on either the work or even the freaking screen itself. Everything is just a blur. -
bioDan56224yQuirks and unknowns may break my codes, but Ruby will never deter me.
Thanks for the TIL! -
dder22814yThe fuck ? The screwdriver project is still on ? *still killing people
Fuck me, maybe it’s time for cork screw Instead. -
@iiii Nah. The problem described here comes from optional parentheses for invocations. In that context, what happens makes sense and is consistent.
JS, on the other hand doesn’t even know what consistency is. All syntax is some random shit behavior depending on numerous conditions. -
@Lensflare namely, which version of Babel is being used, or which bundler you're using.
I fucking hate what the Javascript ecosystem has become. -
What I like about Haskell is how explicit it is about invocation, parameters and order of operations.
What I don't like about Haskell is how many operators there are to denote all the orders of operations and fixities. 😆
f . g . h $ x == f(g(h(x)))
(*2) <$> [1..3] == [2,4,6]
[(*10),(+2)] <*> [2,3,4] == [20,30,40,4,5,6]
flip f x y == f y x
>>> == flip (.)
(f >>> g) x == g(f(x))
(f &&& g) x == (f x, g x)
a <| [b, c] == [a,b,c]
(f ?? x) y == f y x
both **~ 2 $ (3,2) == (9,4) -
@bittersweet I can't read any of that nonsense, that's why I don't like Haskell. It uses way too much symbology and creates terse, unreadable code IMO.
I'm a pretty firm believer that a language should be at least understandable but someone who knows a few languages even if they don't know that language. Haskell does not fit that bill. -
@bittersweet I like the idea of a function composition invocation operator (the dot in haskell, it seems).
There is the famous F# pipe forward operator but none of the popular languages have an equivalent of that.
Maybe it’s because it only works with functions taking and returning exactly one value, but still I’d like to have an operator doing that. Fortunately we can build such an operator in languages that support operator overloading (or custom operators). 🤘 -
@junon Haskell can totally fit that bill — you can alias any operator.
But yeah, in general the community works by convention, and many users of Haskell are academics who like symbolic notations. -
@Lensflare @junon
So yeah it is actually all about composition. Take this sample:
https://github.com/alpmestan/...
What does it do?
It defines a struct (data) with three Text fields, and calls it Upload.
It defines a function called table, which parses HTML tables. The parameter is a List of Nodes, and Maybe it returns our Upload struct with its Text fields
Then recentPackages is a function which takes a Response Bytestring, and returns a List of [Maybe Upload].
It composes methods to read the body from a response, a HTML parser, traversal methods and our table function together.
Then at the bottom, it just prints it all into the CLI.
As far as web scraping goes, I think that's pretty readable -- you can almost just skip over all the silly operator symbols and still understand what it is about. -
@Lensflare
http://hackage.haskell.org/package/...
import BASIC
main = runBASIC $ do
10 PRINT "Hello World"
20 GOTO 10
But also:
https://hackage.haskell.org/package... -
YADU13894yI hate everything except for C++.
People who constantly tell me how easy scripting languages are never mention this kind of BS -
Root797754y
-
bioDan56224y@Root we both know its an interpreted language. Bash however is a command/scripting language. I was addressing the comment about people mentioning "how easy it was using scripting languages" that @YADU was implying about Ruby
-
@Root
> It’s certainly not a compiled language.
I wouldn't say "certainly" 🤓
https://bugs.ruby-lang.org/projects...
🤷 -
-
-
@YADU
I hate everything except Haskell & Rust.
People who tell me how great C++ is never mention this kind of runtime error BS
(Yeah at this point I'm just trolling. But it's justified trolling dammit!)
Related Rants
Ruby’s fanciness bit me in the butt today. It’s pretty rare, but often confusing AF when it happens.
array = [1, 2, 3, 4, 5, 6, 7]
array.count +1 +2
# => 1
What the fuck?
array.count +1 +2 +3
# => 1
What the fuck?
+1 +2 +3
# => 6
Okay.
(array.count +1 +2 +3)
# => 1
What the fuck?
(7 +1 +2 +3)
# => 13
Okay...
array.count + 1 + 2 + 3
# => 13
Alright, so spaces matter here...?
((array.count) +1 +2 +3)
# => 13
But not here!? ... Oh. I think I know what’s going on.
Array#count
Returns the number of elements. If an argument is given, counts the number of elements which equal it using ==
Well fuck me.
Ruby is seeing `array.count(+1+2+3)` instead of `array.count()+1+2+3` since `+1` is a value, not an operator followed by a value as is the case with `+ 1`.
Now, why was I using +1 +2 instead of adding some spaces like I normally would? So they would match what was in the comment next to them for easier reference. Heh.
Future dev, I did this for you! So this is all your fault. :|
rant
ruby