Edit: clarity
138 karma · joined July 30, 2013
Edit: clarity
EDIT: idiom
I have tried to figure out why I want a non-mac for my laptop and concluded I just like change... :) I was almost settled on that dell xps with ubuntu, but if the Surface Books get thunderbolt 3 and this before the autumn I am pretty sure I can't resist anymore...
EDIT: typo
This way lets you achieve something similar to checked-exceptions, and in addition to gain composability of Err (and the like), without adding another language construct (which a language without exceptions would have to do). Got a great deal of experience in other languages that does this, and it's worked out pretty good so far for at least for me once you get the hang of it (i.e. functional coding).
Where I am sitting, that would be a wise choice for Rust, at least if I am understanding it correctly, as it tries to be a safer alternative to other system languages. However, arguably (:), it is OK in dynamic languages or similar that aims trades in correctness for conciseness and, arguable (again :), speed of development to simply have unchecked-exceptions.
Also, it is possible I misunderstood your comment and/or how that code was ugly, in which case I hope the downvotes/replies won't be too harsh :)
EDIT: typo/clarity
To get back on the topic: writing this got me thinking that, maybe in a 100 years from now, the Amish will be the turn-to lisp/fortran/c/cobol? consultants :)
EDIT: typos
In (some) Java _programs_ you would circumvent modelling your domain correctly because it would be too cumbersome to use, therefore Java _programs_ tends to be less typesafe... I suppose that is how I use the term and heard it used in my everyday life, e.g. 'this code is more typesafe than that' and so on and so on...
I guess I should have made it more clear that this how I used the word 'typesafe' (though your definition of it is more correct) and underlined that I meant Scala/Java _programs_ not the language (nor the type system) itself.
Still, it is correct that type inference (rather obviously) doesn't have anything to do with type systems.
EDIT: language, clarity
The problem I tried to describe though is how feasible/typical/normal? it is to catch more or less (type) errors on compile time... Like here, where I basically my point is that it is too hard to use Java's type system to it's full extent because it becomes too cumbersome to actually use it on the callsite.
A while back, I was trying to explain in what ways Scala is more typesafe than Java for a friend (which was one argument to why I prefer Scala so much), and ended up realizing how important type inference is in this regard.
The reason was this: quite often type signatures correctly modelling a domain ends up being pretty hard to read. In a good and proper API, this happens in particular whenever something is composable and is, in fact, composed (if one can say that). I suppose one can say that, for Scala, it took a bit of time before people figured out how to do this properly, rather than just hacking the type system, but I feel that the ecosystem is more or less there now... YMMV though...
As an example: in something like Slick (a functional-relational mapper) in Scala you end up with monads to model your SQL query. One advantage this has is compile errors whenever you're doing something wrong (i.e. more typesafe), but the types that a SQL query representation ends up with will necessarily be pretty hard to read and practically impossible to write (you could have a Query of a long chain of other types for example if you're querying multiple columns). In this example, somebody writing the query might not care about the type of the query. They will care about what the query will end up returning when executed though. I suppose it will lead to trouble when you can't read the type signatures well enough and try to figure out the compiler error, but I reckon it's better to have an error, than to see it fail runtime (at least in my world :). It's easier and safer to do maintenance too, since the compiler and IDEs can know how things should work.
In any case, you could conclude that, in a statically compiled language where you do not have type inference, you'll end up trading in preciseness in the model of the domain, in order to have readable code from the callsite. In turn, this leads to less typesafe code.
One challenge that Java will have even when implementing this though, is how to move the entire ecosystem to something that is indeed more typesafe. This only works if the APIs are doing this right.
EDIT: typos, language and less parens
Setting that expectation aside, I would be fine with something simpler if it:
- it was classy looking: thin and round, steel and real/sapphire glass - ideally something that looks like one of those simple swiss clocks from the 1960s
- had an e-ink screen
- had a gps, which I can turn on and off
- had bluetooth notifications in case my phone is near
- had bluetooth audio support; and
- had spotify support. And here I mean that I want to be able to play music which has been synced to my watch over bluetooth, a cable or while docked.
- had heart-rate monitor would also be a plus of course.
- has enough battery for at least about a week, unless I am using the gps (for 2-3 hours), in which case it is fine if I have to charge it afterwards.
Want to use it as a regular watch (with the occasional message/calendar notification and perhaps even daily weather updates), and as a music player and as a gps for when I am running/biking.
Pebble almost have it, but their watches are way too ugly (my view only of course), too large for my wrists (so says my partner at least) and they don't have the extras that would make me really want one. I guess Spotify would have to be a partner as well, but I have Spotify on my radio so I guess it is only a small step to something like this as well.
Should be possible with todays technology though I am not really into HW. In terms of processor-power it really only needs to keep track of time, draw the watch face every second, draw the notifications/menu/..., handle user input (could be buttons not capacitive) and play music (which probably is the most resource intensive thing, but an easy match for any modern SOC). So for processing, battery shouldn't be a problem. An e-ink screen is thin and does not require much power either. Bluetooth 4 LE chipsets are very power friendly I think, so I would imagine that should be fine as well. They are also fast enough (1 mbp/s) for syncing notifications and even for the occasional sound track sync (I don't mind waiting 5-10 minutes for an album). The gps doesn't really have to give me directions, only log my position and would be used only when I am running/biking, and as I said, should be possible to switch it completely off.
The battery could be in the (detachable) wristband - I think I have seen quite thin and flexible polymer batteries around on the internet (though I am not sure if they are thin/flexible enough). Could also have different looks on the wristbands so you get one leathery-looking (for normal usage) and one plastic looking (for sports) like apple did (liked that part though it is hardly innovative).
Full-stack, Scala, Play, Slick, builds (sbt)
Former Scala/Play trainer
Remote or near Stockholm, Sweden
Contact: my username at gmail dot com
Github: my username