« first day (1780 days earlier)      last day (3393 days later) » 

13:00
!!>fetch.toSource()
@Cauterite "function fetch() {\n [native code]\n}"
oh, that's news to me
Hello everyone, I have this fascinating essay to redact for school: why do you think that JavaScript has reached such a high popularity in the past years despite its glaringly atrocious defects?
It's supposed to be neutral of course, I'm taking all opinions
@MaiLongdong because it's been greatly improved in recent years
in terms of language features and browser implementations
For example?
13:04
@MaiLongdong And "atrocious defects" is neutral? :D
Well I suppose that's fairly objective
html5 offline...I still don't get a sense of those app cache events...why would I be interested in them?
@MaiLongdong pretty much everything they've added since ecmascript 4
user406009
@MaiLongdong 1. Only option for web. 2. Defects aren't bad enough to kill the language, and can be overcome with some coding style practices.
Okay so it's more of a "no other choice anyway" response from what I get
13:06
it's a highly multi-paradigm language
both OOP and functional programmers will find a subset of the language they can use comfortably
Hmm can it do logic programming?
There have been some attempts to replace it but all unsuccessful
inb4 troll
The thing is, the language itself is fine, just the DOM API kinda sucks. And for that we have jQuery.
Do you think that if browsers had implemented more languages JabbaScript would have had such a high market share?
IOW is the success due to the nature of JavaScript or the environment
13:08
yes
compilation to javascript is a rather low barrier
@AwalGarg "undefined" Logged: {}
[rospoiler]
it's just that compile-to-javascript languages are all just javascript-in-disguise
guys you said due to securities screen sharing between two mobiles not possible, but see this
user406009
@JanDvorak It's also hard to justify the cost of locking yourself out of a whole ecosystem of libraries and possible developers.
13:13
@JanDvorak jdom ftw!
@MaiLongdong IMHO environment for sure. It's the only choice for in-browser dev.
user406009
Well, there are other choices, the compile-to-JS languages. But JS has the most support in terms of tooling and libraries.
Will this fail if these are undefined? this._connected = this._socket1._connected && this._socket2._connected;
@corvid Yes.
@corvid define "these"
13:18
Those are just two net.Sockets and this is just the object they're bound to
user406009
@corvid This (dorey.github.io/JavaScript-Equality-Table) is always handy to have around. The third tab is quite useful.
@corvid define "fail"
these /T͟Hēz/
pronoun
plural form of this.
@rlemon thanks, i felt like i was missing something
@corvid this usually isn't null
13:20
!!>this
@Cauterite "undefined"
it might be undefined though
@OliverSalzburg "We recommend that you do not use this in production"
Not sure if a private userscript counts as production usage
@MaiLongdong i don't think there's much about the language itself you'd call "glaringly atrocious defects" — most of its problems are in its implementations (and documentation)
@corvid if a is null then a.something will blow up.
13:24
the language itself has a few misfeatures, but overall it's pretty solid
simple as that.
@Lalaland any decent JavaScript dev should know the third tab by heart
First one looks like Game of Life :)
!!> ["0"] == false
@MadaraUchiha true
13:32
XD
that one's pretty nasty
I just never use == in my code
I rarely use if (someValue) unless I know its type for a fact.
There's no shame with if (foo === undefined)
user406009
Null == is the only decent one. As null == undefined.
@Lalaland null is a value that arguably shouldn't exist
It's an attempt to appease the Java gods.
i prefer the word null over undefined, but it's a pretty shoddy feature
user406009
13:36
Null is fine in a dynamic language. Undefined is the one that needs to bdie.
@Lalaland What is null?
in my react render, I have var invitedCollaborators = this.showCollaborators(this.state.collaborators.slice(0, 8)); and then console.log(invitedCollaborators) .. one line it shows [ReactElement, ReactElement] and then [] . why ?
When do you use it?
Validation of required fields is the first that comes to mind
user406009
As an initialized value.
13:37
user406009
Uninitialized *
@Lalaland Oh? Because I was thinking it's an empty value, that you return when you have no object to return
Or perhaps it's a value that's returned upon error
Or perhaps....
It never ends.
:( coz its being called twice .. bah W.a.S
We've been there in Java
null and the NullPointerException tumor is one of, if not the worst feature of Java.
user406009
@MadaraUchiha yes. It's a combination of multiple things. Welcome to dynamic typing.
13:38
i think i tend to code in a way that doesn't ever try to distinguish between null and undef
user406009
@Cauterite Same.
@Lalaland undefined is plenty for uninitialized value (it's value not yet defined...)
The only real difference between undefined and null is that undefined says what it is and when it's being used in the name
undefined is used for any value that's not defined (yet).
null is used for whatever the developer felt like its used.
user406009
@MadaraUchiha Fine. Only have undefined then. I don't really care. Just that null and undefined together are unneeded.
@Lalaland No arguments there.
You can't have nullable types without null pointer exceptions
13:41
@JanDvorak Java doesn't even HAVE pointers
And primitives aren't nullable
And yet it has a null pointer exception
@JanDvorak And you know what? Fine, I get it, throw an exception when I try to access a method on null
But tell me WHAT I DID WRONG
I am a shit
good().luck().finding.the.nullObject().here()
@JanDvorak Good luck with that.
Don't most languages have the same problem?
13:44
@JanDvorak I dunno, this was mostly fixed in JS
Just because most languages have the same problem, doesn't mean it's not a problem
I haven't really looked at too many other languages
Guys... I just passed my Motorcycle test :D
2
@Cerbrus Huzzah!
@MadaraUchiha How does NPE not tell you exactly what you did wrong?
13:44
*Jumps around frantically :D*
@KendallFrey Which method did I call and on which object that was null?
user406009
@JanDvorak in statically typed languages you can encode nullability in the type signature. Makes things a bit easier.
The example I put above is a bit exaggerated
@Cerbrus Congrats! :-) What motorcycle are you going to ride?
But here's a completely valid one:
13:45
@MadaraUchiha So you just need a line number, basically
Heck, even Haskell has non-descriptive error messages if you get them at runtime
getUser(Publisher.byId(publisher.getId().getValue()), User.byName(publisher.getName().getFirstName().getValue());
@KendallFrey ^^
Yeah, have fun with a line number
13:46
@MadaraUchiha Methinks the problem is not in the error message
@m Java has variables, you know?
@KendallFrey Obviously this is crappy code
Luckily no one writes crappy code, right?
And luckily we never ever have to maintain crappy code, right?
@JanDvorak what?
on a tangent, what's your opinion of a nullable . operator like we now have in C#?
13:47
The point of an exception being thrown and not caught is to raise as much noise as possible to make the error stand out as easily as possible.
@Cerbrus Ah, cool. Also, dafuq, are you dutch?
i.e. rather than throwing an error, the expression returns null
Just a line number is definitely enough to find the error. But it would take me a minute and not 3 seconds
I never knew...
100% Nederlands man :D
13:48
@KendallFrey I rather it throw an error
@KendallFrey almost as good as the maybe monad
I personally never return nulls or undefineds from my functions
@JanDvorak Maybe makes me hate C#'s null handling :P
In JavaScript obviously there's the implicit return undefined if you don't return anything
Meteor is weird sometimes :|
13:49
But I'll never explicitly return null or undefined and will never use the return value from a function I haven't returned from./
An undefined in a value is almost always an exceptional case
If a function is to fetch data from some remote source, I expect an empty array/list/set/whatever if nothing had returned
Not a null
Gotta be afk for a while, bbl :-)
So either a list of something, or a list of nothing, or an exception
!!afk doing... things
@MadaraUchiha what if it has to return only one thing, and that one thing is not found
@Cerbrus Stop masturbating on your bike, these stains never come off
13:51
what should "a".indexOf("b") return?
@m what if you want to find at most one element?
@AwalGarg That usually depends
@Cauterite try and tell us
@AwalGarg i'm asking what it should return
user406009
@Cauterite null. That's what it should return.
13:52
@MadaraUchiha I mean, null in that case seems ok to me if I am expecting no results to be a valid case
@AwalGarg Yes, that's one usecase.
user406009
A better example is [a, b, C].find(predicateFunc)
But in that case, the undefined or the null (whichever you choose to use) is expected
It should return either Nothing or Just Int
@Cauterite I would like NaN just for the lulz
13:54
@AwalGarg i'd probably consider it too :P
user406009
NaN is an abomination. NaN != NaN is nonsense.
I personally think -1 is pretty good itself.
signalling NaN aint so bad, but quiet NaN can burn for eternity
There should be one and only one NaN
user406009
@AwalGarg that only works because its indices. Think about my find example.
13:56
@awal there is, and it doesn't equal itself
using -1 in place of null always seemed pretty dirty to me; the kind of behaviour you'd find in C functions
@Lalaland yeah I get your point. It's just history all the way down.
C is awesome. cc @FlorianMargaine
@c yay for traditions
13:58
@JanDvorak NaN !== NaN would have made a lot of sense if typeof NaN didn't return "number"
@a we also have an object that isn't an object, and a non-object weakly equal to it
null and undefined :D
null is an object because the first JS implementation treated it as such (internally)
Yay for traditions :-)
Also, yay for leaked implementation
i've been thinking for a while about whether there's any reasonable way to design a dynamic language without some form of null
For this code,
function Employee() {
  this.name = "";
  this.dept = "general";
}
here is the memory repre
14:03
@JanDvorak Well, there wasn't any es specification at that time so it wasn't a proper implementation anyways
@JanDvorak @AwalGarg To be fair, those quirks are so unimportant that I, for once, really don't care about them
For this code, How do I visualise memory repre?
function Manager() {
  Employee.call(this);
  this.reports = [];
}
Manager.prototype = Object.create(Employee.prototype);
@overexchange pretty sure v8 would use a hidden class here
In both cases
v8? am new to JS
V8 is google's JS engine
14:05
Yay for making crude images for help vampires :-D
V8 is my car's engine
> I once tried to fix that but it just lead to crazy problems, therefore making this a documentation issue. (bugs.php.net/bug.php?id=43283)
5
how intelligent
Php sucks
@AwalGarg lol
@JanDvorak but yo mama is just awesome at sucking
@a hey! That's not how the joke goes
14:09
@JanDvorak Why only one letter?
@m so that I target without pinging
@JanDvorak You are confusing factual information from a respectable source with a joke.
Uncyclopedia is not a respectable source
@MadaraUchiha Kind of a letdown, tbh. I was hoping for some trick of optics
@Ṣhmiddty Can probably be done with a little mirror trick
Similar to an infinity table
14:16
@MadaraUchiha Yeah, that's what I was thinking it would be
14:29
hello hello
how is everyone
I am back from vacation
where?
I was in Bulgaria
now I am back in the Netherlands
!!google Bulgaria
@Cauterite you don't know where Bulgaria is?
14:30
i do now
btw there were a boatloads of Australians in my home city this summer
I met like 10
which is strange
cause it is far far away
!!google summer
Netherlands is one of the few places that can compete with Australia
:P
Australia is being taken over by toads.
all because one asshat decided it wouldn't be so bad to release a few non-native species
14:32
@Cauterite not really, the weather here is horrible and there is no nature and women are not that nice and they are confused a bit because of emancipation
and the food sucks
so I don't see how it can compete
But... Free bikes
@rlemon hi, I wanted to ask you something about JS animations
Women are confused due to emancipation?
maybe you have an idea
Is there something about the netherlands I don't know about
14:33
@Cereal yeah, they are angry sometimes when you pay their drink, and they are angry when you don't pay for it
cause they want to be equal to men but at the same time feel like ladies
Solution: Don't go to clubs
What don't you know?
so it depends on the girl that you meet, but you never know
my gf does that. It's a "mans job" when she doesn't wanna do it. but if I ever mention "womens job" I'm in the doghouse
"Do you wish me to pay for your drink"?
14:34
"Can I buy you a drink" seems pretty normal
Can anyone tell me how to make in Javascript, or if there is already something like that, where you can drag a square (div or span block) and animate it like throwing a piece of paper from a table
@rlemon input on this?
@ziGi Like, flick it away?
@ziGi Velocity.js or GSAM
yeah, just flick it away
14:35
but you'll have to do a lot of the work yourself.
those are just nice animation libs
both iirc implement easing functions
isn't there something done that I can reuse?
@ziGi just look up <my library> + ' paper falling ' or something
what is your library?
14:37
is there a pro way to check a year is a leap year with new Date() or something other than %4 %400
@JanDvorak thank you
@ar try to create a feb29 of that year?
i.imgur.com/SV28ZmM.gif now that is how you break!
@rlemon Yeah, you use your head.
looks kinda nice
I think I'll use it .
14:40
nice
Thanks guys for Velocity.js
I think it'd do the trick
@AwalGarg lol
@argentum47 You could try creating a date of 29 Feb and see if it works
@rlemon Hack === DejaVu Sans Mono
@rlemon brake*
@SomeGuy I'll break you
14:41
hmmm ..
@rlemon Good, now you know how to use it! :D
!!> (new Date(2014, -1, 1)).getMonth()
@argentum47 1
@NathanJones so?
14:42
@argentum47 0
slightly different is still different.
@argentum47 11
i see, so
¯_(ツ)_/¯
!!> (new Date(2014, 1, 29)).getMonth()
14:43
@argentum47 2
@NathanJones what's that blinking red square?
you dropped this \
ah
!!> (new Date(2016, 1, 29)).getMonth()
@argentum47 1
thanks ¯_(ツ)_/¯
nope still missing
14:43
¯\_(ツ)_/¯
I tried.
@JanDvorak no idea
¯_(ツ)_/¯
Try writing it twice
\¯_(ツ)_\¯
¯\_(ツ)_/¯
oh yeah
¯_(ツ)_/¯ \¯_(ツ)_\¯ ¯_(ツ)_/¯ \¯_(ツ)_\¯ ¯_(ツ)_/¯ \¯_(ツ)_\¯
caprica dance
14:45
!!sandbox
@JanDvorak Please go and play in the Sandbox
its art
steves jobless
@argentum47 how about you use some apostrophes for a change?
@rlemon i shouldn't be an asshole. use whatever font makes you happy.
wingdings
14:48
that would be cool . but now that I think of (new Date(2016, 1, 29)).getMonth() and (new Date(2014, 1, 29)).getMonth() how did this work ?
how did it know the first is 1(feb) and second is 2(march)
@rlemon if you can read it, you are free to use it for personal use
var isLeapYear = !(dateObject.getYear() % 4)
@FlorianMargaine isn't it?
@AwalGarg it has its ups and downs
@FlorianMargaine totally unexpected answer
14:53
just installed Hack on Sublime Text 3
it is for sure a noticeable difference from the default font on Ubuntu
I remember reading about security recommendations for the fsf employees a few days ago...
anyone can find it?
@rlemon any idea how I make it that the piece of paper gets accellarated with the drag start and drag stop
HAMMERTIME!
like, the computer should have luks, this kinda thing
14:59
@rlemon do I bottle before the brew is done fermenting, so that there's enough yeast still alive to carbonate the cider?
> I realized that the debugger will always break on files on line 22 (or one of the following, if line 22 is a comment. I also realized that all of the files are named index.js...

I then realized that I have a breakpoint set in my code, in a file named index.js on line 22. This causes the debugger to break on all line 22 in any file named index.js.
Priceless :P
so if I accelerate it with a faster drag then it flies faster, otherwise it flies slower
WebStorm JS debugger

« first day (1780 days earlier)      last day (3393 days later) »