Re:Why do dynamic languages make it more difficult to mainta...
by ent on Monday January 27, 2014 @02:59PM
(#7132766)
But the cool thing is that in many (most?) cases you can actually infer the type of reading from a string. You are going to do something with that value right? So you can say
1 + (read "1")
and the compiler will know that you must want to read "1" as a number and does that!
[ Parent
| on HN ]
Re:Why do dynamic languages make it more difficult to mainta...
by dllthomas on Thursday January 30, 2014 @10:36PM
(#7155086)
Yeah, I most commonly hit "oh, I need to annotate that" when I'm building some expression piece by piece in ghci, and so effectively what I'm doing with that value is "print it, as appropriate to the type" - which doesn't tell us much about what type it is.
Re:Why do dynamic languages make it more difficult to mainta...
by platz on Monday January 27, 2014 @03:25PM
(#7132961)
That kind inference only works because + is defined to work on Nums only (importing only prelude). You don't even need the initial 1. A nice trick but these are rather small details.