Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

qntm posted:

yup

as far as i can tell this class exists solely to annoy people

i guess, but why would you ever use it for anything?

Adbot
ADBOT LOVES YOU

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
okay, i looked at the mdn documentation and it is completely useless. it has no useful methods (toSource, toString, valueOf).

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Wheany posted:

okay, i looked at the mdn documentation and it is completely useless. it has no useful methods (toSource, toString, valueOf).

it has length, which is always 1!

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
I don't think Boolean is supposed to be a class or anything, it's just a function that converts your poo poo to true or false.

the fact that you can use new with Boolean is just how new works (like garbage)

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
just use !!

qntm
Jun 17, 2009

Wheany posted:

i guess, but why would you ever use it for anything?

you wouldn't, and you shouldn't, ever. the whole class shouldn't exist and if the word "Boolean" appears in someone's source then that person is living in a state of sin

MeruFM
Jul 27, 2010

Symbolic Butt posted:

javascript's new operator is stupid as heck

I didn't realize this was a thing (or at least have the slightest inkling of what it did)

now I do and i'm less happy for it

thanks js

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Boolean is there so that you can box boolean values in places where you need an object, just like in Java. Adding ad-hoc properties, for example, in the JS case; storing in a pre-generics collection in Java.

Boolean.prototype.valueOf could have automatically unboxed, but I'm not sure that magic would have been better.

(Boolean.length is the length property that all functions have, it's not a property of the prototype.)

hepatizon
Oct 27, 2010

Subjunctive posted:

Boolean is there so that you can box boolean values in places where you need an object, just like in Java. Adding ad-hoc properties, for example, in the JS case; storing in a pre-generics collection in Java.

Boolean.prototype.valueOf could have automatically unboxed, but I'm not sure that magic would have been better.

(Boolean.length is the length property that all functions have, it's not a property of the prototype.)

boxing of primitives is a horrible feature that shouldn't exist

gonadic io
Feb 16, 2011

>>=

hepatizon posted:

primitives is a horrible feature that shouldn't exist

gonadic io
Feb 16, 2011

>>=
in memory managed langs anyway

DimpledChad
May 14, 2002
Rigging elections since '87.
just gonna leave this here: https://www.destroyallsoftware.com/talks/wat

fun starts at 1:20

Bloody
Mar 3, 2013

DimpledChad posted:

just gonna leave this here: https://www.destroyallsoftware.com/talks/wat

fun starts at 1:20

im the people in the background that dont know how to laugh like people

abraham linksys
Sep 6, 2010

:darksouls:
huh, rewatching that talk for the first time since I've gotten "decent" at javascript (aka DEHUMANIZE YOURSELF AND FACE TO PROTOTYPES), and I think he actually gets something wrong. he seems to say that this:



is an object, but it's not; it's a string:



which is, of course, also stupid, because javascript. it is at least one of the few implicit conversations in that talk that you can actually puzzle your way through ([] gets toString() cast on it for "", {} gets toString() called on it for "[object Object]", and they're concatenated)

javascript's handling of operators and type conversion is, afaik, the worst in any common language outside of maybe php, and my least favorite thing about the language

TheresNoThyme
Nov 23, 2012
IIRC the + 1 vs -1 trick is just because javascript overloads the + operator to be usable for string concatenation, which really isn't uncommon though it is certainly confusing as gently caress when you're working with dynamic vars

What I'm saying is lol if you never tried to do a string-> numeric conversion in js using (somevar+0), spent an hour figuring out why that didn't work, then smugly changed it to (somevar-0) and called it a day. Number() is for wusses

TheresNoThyme fucked around with this message at 01:59 on Nov 12, 2014

Bloody
Mar 3, 2013

{}
undefined
a = {}
Object {}
a + []
"[object Object]"
{} + []
0

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

TheresNoThyme posted:

IIRC the + 1 vs -1 trick is just because javascript overloads the + operator to be usable for string concatenation, which really isn't uncommon though it is certainly confusing as gently caress when you're working with dynamic vars

"1" + "1" == "11" is totally fine.

1 + "1" == "11" is not.

I think even PHP makes more sense with both being 2 if you think of the + operator as a numbers thing.

Arcsech
Aug 5, 2008

Symbolic Butt posted:

"1" + "1" == "11" is totally fine.

1 + "1" == "11" is not.

you're right, the second should be a type error

Bloody
Mar 3, 2013

And the first is false because they are different string objects

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
anyone who talks about "objects of class Boolean" in js has no loving clue how it works and is not qualified to say how good or bad it is

abraham linksys
Sep 6, 2010

:darksouls:

Tiny Bug Child posted:

anyone who talks about "objects of class Boolean" in js has no loving clue how it works and is not qualified to say how good or bad it is

you can do `new Boolean(true)`. you shouldn't, but you can, and that is an object of class Boolean

(unless you're going to get really pedantic about "an object with prototype Foo" not being the same as "an object of class Foo" but then gently caress you)

suffix
Jul 27, 2013

Wheeee!
https://pachyderm-io.github.io/pfs/

i found this funny, maybe someone else here will too

quote:

Pachyderm will eventually be a complete replacement for Hadoop, built on top of a modern toolchain instead of the JVM. Hadoop is a mature ecosystem, so there's a long way to go before pfs will fully match its feature set. However, thanks to innovative tools like btrfs, Docker, and CoreOS, we can build an order of magnitude more functionality with much less code.

quote:

Rather than calling a map method on a class, Pachyderm POSTs files to the /map route on a webserver. This completely democratizes MapReduce by decoupling it from a single platform, such as the JVM.

hey btrfs has some cool features, you could easily make a distributed system by gluing some exec calls and http on top of that, right?

in fact lets replace YARN, HDFS and MapReduce all at once, to make it a full weekend project

and instead of hard things like stdin/stdout let's democratize it by using something all programmers know how to write... web servers

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
classes are *not* the same as prototypes. this is not a trivial distinction. js does not have classes and expecting prototypes to work like classes is basically the root of every moronic UGH JS INHERITANCE IS SO BAD complaint there is, so gently caress you for helping to propagate that misconception

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Tiny Bug Child posted:

classes are *not* the same as prototypes. this is not a trivial distinction. js does not have classes and expecting prototypes to work like classes is basically the root of every moronic UGH JS INHERITANCE IS SO BAD complaint there is, so gently caress you for helping to propagate that misconception

javascript is bad

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
seriously don't know how you are such a goddamn web hipster that you're tweeting about whatever this week's hot new js framework is every day but you still manage to say something as dumb as

abraham linksys posted:

(unless you're going to get really pedantic about "an object with prototype Foo" not being the same as "an object of class Foo" but then gently caress you)

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i dont really understand js but i like how you can pass around functions and i like how the fact it has very little support for including or importing or whatever makes your language feel pretty stable

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
it's almost like all those dumb loving frameworks hide the operation of the actual language from you just to replace it with a worse language that has no application outside the framework

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

woah tbc turning abraham linksys into tiny bug bitch itt

jony neuemonic
Nov 13, 2009

Tiny Bug Child posted:

it's almost like all those dumb loving frameworks hide the operation of the actual language from you just to replace it with a worse language that has no application outside the framework

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
i also like whatever language feature makes callbacks very natural for js. maybe it's closures or something. idk. maybe it's also the fact that it's only legitimate use is for ajaxy stuff.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
what about Number() vs parseInt()

abraham linksys
Sep 6, 2010

:darksouls:

Tiny Bug Child posted:

classes are *not* the same as prototypes. this is not a trivial distinction. js does not have classes and expecting prototypes to work like classes is basically the root of every moronic UGH JS INHERITANCE IS SO BAD complaint there is, so gently caress you for helping to propagate that misconception

es6:

The Boolean constructor is designed to be subclassable. It may be used as the value of an extends clause of a class declaration. Subclass constructors that intended to inherit the specified Boolean behaviour must include a super call to the Boolean constructor to initialize the [[BooleanData]] state of subclass instances.

when the people who make the languages don't see the need to distinguish between a prototypical constructor and a subclassable constructor, I don't think it's bad to call it a class, man

(also for funsies, though I don't think it has any real merit in this discussion: in es5, The [[Class]] internal property of the newly constructed Boolean object is set to "Boolean".)

jony neuemonic
Nov 13, 2009

js has problems but not having class-based oop isn't one of them.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

MALE SHOEGAZE posted:

i also like whatever language feature makes callbacks very natural for js. maybe it's closures or something. idk. maybe it's also the fact that it's only legitimate use is for ajaxy stuff.

nah closures own outside of ajaxy stuff and callback hell when you realize that you can have generic looking functions that allow you to pass objects and the callbacks that handle them correctly in and get the same data out every time

TheresNoThyme
Nov 23, 2012

Blinkz0rz posted:

what about Number() vs parseInt()

parseInt("99abcdefg10456") => 99

not even once

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
my #1 problem with working with javascript in the real world is that i find myself wanting to write c style ifdef poo poo in order to stop js assets from being downloaded over and over again

this is most certainly due to a total misunderstanding on my part as to how javascript and programming and the internet in general work

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
ecmascript 6 or whatever it is has classes, sure. it has an actual class keyword that's not just a reserved word for no apparent reason. but that is not javascript, that is a language that currently does not really exist

the class property thing doesn't count either and i would be really surprised if that had any cross-browser compatibility

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

fidel sarcastro posted:

js has problems but not having class-based oop isn't one of them.

it kinda is a problem when they aped java syntax and actually only got prototypal inheritance right in es5

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Blinkz0rz posted:

nah closures own outside of ajaxy stuff and callback hell when you realize that you can have generic looking functions that allow you to pass objects and the callbacks that handle them correctly in and get the same data out every time

oh yeah i meant that callbacks are natural for js because js is 99% of the time used for ajaxey poo poo. the closure thing was a separate drunk thought

Adbot
ADBOT LOVES YOU

abraham linksys
Sep 6, 2010

:darksouls:

fidel sarcastro posted:

js has problems but not having class-based oop isn't one of them.

it's getting the "classical sugar over prototypes" several frameworks (backbone, ember, ampersand-model, winjs, et al) and libraries already implement in ad-hoc fashion

https://github.com/lukehoban/es6features#classes

TheresNoThyme posted:

parseInt("99abcdefg10456") => 99

not even once

code:
$ irb
2.1.2 :001 > '123asdf'.to_i
 => 123
misery loves company, I guess

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply