Sampilo: Really enjoying ecma 6
Workinger: I thought overloading was multiple constructors?
Hickam: Also, Overloaded seems to be completely unnecessary to that example.
Kuckens: Function overloading can be any function, not just a constructor
Hickam: There is no overloading available
Rabuse: In other languages that support it anyway
Kirsten: Var do***ent = p****r.p****’!DOCTYPE htmlhtmlhead/headbodyHi there!/body/html’ is the do***ent variable a js word?
Hickam: Django_: just a varilable name.
Zahniser: Hickam: on my sublime it comes out blue, file is /js
Hickam: Django_: by default, it’s bound to the HTML DOM do***ent
Hickam: Which is probably why
Hickam: You probably don’t want to shadow it, you probably better to just call it doc
Wage: Im following this: https://www.npmjs.com/package/p****5
Farrall: I tried the example in ‘usage’ ran it and the output is emptu
Stambach: I hope the maintainers of javascript eventually get around to adding function overloading :
Breuninger: Fprophet: overloading is a bad idea in general, though. Most of the time, you actually want something like dynamic dispatching.
Ashley: Dekok: how is it a bad idea?
Wydeven: And JS already has that one :
Wigger: Fprophet: it’s hard to reason about, without giving you any actual benefits. Specially with things like operators.
Sheen: It’s less bad when overloading just the arity, but JS can’t do that because all functions are variadic.
Quencer: And you can always just write different functions anyway. Which would be the very same thing.
Opher: Dekok: well it would be valuable for me right now for my current project, multiple constructors with or without certain arguments to perform a different task 😛
Hickam: Though, it’s a lot easier to write a function that “supports” it with destructuring and default argument values
Bolerjack: Fprophet, it may seem like it, but usually that’s not a good idea
Copney: Fprophet: having a single constructor that takes several different configurations is a sign of bad design. Also, v8 won’t be able to optimise your code.
Bolerjack: If you need “overloading” you may want polymorphism, and can do that in JS with duck typing
Squadrito: Fprophet: just provide different constructors instead
Ards: Fprophet if the issue is your function arguments, p*** in an object as the first parameter instead
Prosch: Or what Dekok just said
Boss: It’s more of a convenience I guess
Puma: Fprophet: it’s not convenient for you, nor for the person calling your code, though.
Bolerjack: What is the use case? what is an example?
Sessler: Languages **** : we still add things to languages that’s supposed to make it easier for developers and we haven’t stopped _
Samas: Fprophet: separating the functions gives you 1 fast code; 2 easy-to-reason code; 3 easy-to-maintain code; 4 simple code, for both you, and whomever decides to call your function; 5 you can actually compose it, unlike ad-hoc polymorphic functions based on the arguments.
Gedris: Operator overloading is really nice when you want to create “containers” You can overload . it’s really nice for things like vectors/matrices. etc
Mcnaught: I’m just wanting to add dynamically add content to a page if it hasnt been created already. its’ not important. I was just curious if the language had it
Hickam: Rcyr: but isn’t that useful if you don’t have operators at the same time
Bolerjack: I don’t see much pain in doing Vector
Aguillar: There are a million ways for me to achieve the same thing I want, though
Vanstrander: Bolerjack: var r = vec1 + vec2 + vec3; or var r = vec1.addvec2.addvec3 ?
Meyerhoff: Currently I’m just playing around with ecma 6 and I’m actually enjoying it a ton