Scott Anderson
06/19/2019, 4:09 PMJason Priestley
06/19/2019, 4:19 PMf('hello', 5)
then you will end up calling 'hello'+1 here" is a lot more friendly than "cannot unify constraint x : number
arising from use of + : number -> number -> number
with x : string
in type signature of `f`"Ivan Reese
yairchu
06/19/2019, 4:31 PMshalabh
06/19/2019, 4:32 PMWouter
06/19/2019, 4:35 PMWouter
06/19/2019, 4:37 PMScott Anderson
06/19/2019, 4:48 PMyairchu
06/19/2019, 5:07 PMDoug Moen
06/19/2019, 5:27 PMtbabb
06/19/2019, 5:46 PMDrewverlee
06/19/2019, 5:52 PMDrewverlee
06/19/2019, 5:59 PMScott Anderson
06/19/2019, 6:10 PMtbabb
06/19/2019, 6:15 PMJustin Blank
06/19/2019, 6:31 PMFelix Kohlgrüber
06/19/2019, 6:45 PMDrewverlee
06/19/2019, 7:01 PMDrewverlee
06/19/2019, 7:03 PMgman
06/19/2019, 7:25 PMclass Foo {
constructor(width, height) {
this.width = width;
this.height = height;
}
}
I then added more parameters and decided I'd rather pass in an object so I can add more and more parameters
class Foo {
constructor(options) {
this.width = options.width;
this.height = options.height;
this.speed = options.speed;
this.weight = options.weight;
}
}
but I realized I can just do this
class Foo {
constructor(options) {
Object.assign(this, options);
}
}
it does the same thing effectively. Yes I know it's dangerous and evil and I'll pull it out but it's tempting because I can add more and more parameters and don't have to write any new code to accept them. But, there is now ZERO documentation 😭Duncan Cragg
06/19/2019, 7:50 PMnumber
, temperature
, [ab].*d
, {1 30 93 }
or < 100
. This extends beyond simple values up to the shape of more complex structures like hash/map/object and list/array.Duncan Cragg
06/19/2019, 7:52 PMDrewverlee
06/19/2019, 9:02 PMDoug Moen
06/19/2019, 11:55 PMDoug Moen
06/20/2019, 12:07 AMDoug Moen
06/20/2019, 12:20 AMslider(1,10)
constrains the local variable to be a floating point number between 1 and 10, and displays a slider widget for changing the value. Or, scale_picker
treats the variable as a "scaling factor": it is constrained to be a floating point number > 0 and < infinity, and a kind of logarithmic slider is used to change the value.
Even though picker expressions constrain the value of a variable, these value constraints don't necessarily correspond to types in any statically typed language that I know. So it's not clear that a static type system is even the right tool for the job.yairchu
06/20/2019, 9:12 AMyairchu
06/20/2019, 9:13 AMKonrad Hinsen
06/20/2019, 1:55 PMDrewverlee
06/20/2019, 4:01 PMyairchu
06/20/2019, 5:52 PMDrewverlee
06/20/2019, 6:31 PMAlan Johnson
06/21/2019, 5:37 AM