Python to OCaml: Retrospective
roscidus.com
roscidus.com
This seems a much safer/saner way to do total rewrites/refactorings.
Note that it practically demands decent (if not impeccable) test coverage (he even admits that many parts were not tested... the only saving grace being that due to the semantics of the 2 specific languages here, he was able to use roughly the same logic for the less-tested portions, reducing risk).
Also note that according to the graph, during the middle of this process, application and testing performance will be the most terrible. At that point, some managers would probably decide to back out/bail on it, which is why I thought it was important to note.
Which brings up an interesting idea:
* All codebases are in some kind of inflight transition. Usually not migrating across languages, but often migrating across authors and authoring styles, sometimes migrating across underlying platforms. So, things that make these inflight transitions easier might well be practices one should consider adopting.
* The "data interop layer" might simply be another way of understanding another principle: if your data structures/formats are (a) legible and (b) well-fitted to your problem domain, your program is probably going to be easier to understand and modify... maybe even when it comes to modifications that might seem extreme.
Or to use words attributed to Linus Torvalds: "Bad programmers worry about the code. Good programmers worry about data structures and their relationships."
So I'm starting to think more about formal specifications and documenting serializations formats first and worrying about the code second.
update: punctuation corrections
update
after reading :
http://roscidus.com/blog/blog/2013/09/28/ocaml-objects/
the language sounds quite interesting. Does it support something like channels ?
There is some interesting work being done on an effects system [1] which would be another option for type-safe concurrency, hopefully it will land soon alongside the multicore work.
There is also the old fashioned way with the stdlib's Event module[2] (in conjunction with Thread), but that's not used as often, mostly because Lwt/Async offer richer, safer abstractions.
[1] http://kcsrk.info/ocaml/multicore/2015/05/20/effects-multico...
[2] http://caml.inria.fr/pub/docs/manual-ocaml/libref/Event.html
That's what TFAA (and MirageOS) use.
In case of Unison – it's a program done by a brilliant Computer Scientist and author of one of the best books I've read (well, reading) "Types and Programming Languages" Benjamin Pierce. I know he had put quite some research effort into that tool, but I don't see community-related infrastructure around it being in place, that's why it looks (or maybe is) rather abandoned.
Btw, here's another fun video of B. Pierce making some intriguing statements regarding a popular file-sync program called Dropbox https://www.youtube.com/watch?v=Y2jQe8DFzUM
Better tooling would help so that you'd get the error checking as you type. Are there any good configurations for vim or Emacs, for example?
For someone new to the type system, it helps a lot to compulsively keep checking the types of the expressions as you go along building the program. Highly recommended.
PS: If you prefer screenshots - https://twitter.com/prakharsriv9/status/689141428161802241
Really nice.
The funniest thing is that in my experience Merlin just seems to work. When I think about how many hoops I need to jump through with the Clojure REPL to connect it to CIDER in Emacs, Merlin just works in the background without me having to think about it at all. Very impressive.
Then I realized that it wasn't totally clear to me what json_list_to_str_vector() should do, exactly, and so I don't even know how it would compare.
When this article was written Rust had a big runtime. It was a very different language. OCaml is pretty fast, but I would still expect Rust to fare much, much better today.
It just converts a JSON-encoded list of strings into a Vec<String> doesn't it? That's what the other languages do:
* get data from some envvar
* decode it from json to an array/list/vector of strings
* concatenate argv[1..]to the result of (2)
* execute this new argslist (the first item being the name of the program)
> Everything would be incredibly fast, but getting new contributors would be very difficult due to the learning curve. There’s a risk of crashes as the library is not entirely memory safe, and there are likely to be changes ahead to the language. Probably writing the whole thing in ATS would be too much work for anyone.
ATS didn't make it to round 2[1] on grounds of use difficulty and difficulty of separating memory-safe and memory-unsafe code.
That seems prescient as the original ATS1 (ATS/Anairiats) was replaced by ATS2 (ATS/Postiats) a few months later, I don't know how compatible the two are but the FAQ puts ATS1 and ATS2 in different categories[2]
[0] http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-r...
[1] http://roscidus.com/blog/blog/2013/06/20/replacing-python-ro...
[2] https://github.com/githwxi/ATS-Postiats/wiki/ATS-implementat...
He says the color of the UI part is orange but i see yellow
That specific color is between the yellow and red range, although it is closer to the ideal yellow. Some people learned that this still counts as yellow, while others learned that this is yellow is "red enough" to count as orange.
This also hints at the "qualia" mystery...
With a hue of 7˚[0] the middle color is in the middle of the red range[1], it's on the pink side of scarlet (8.5˚, 100%, 100%).
The rightmost bar has a hue of 47˚[2] making it an orange-yellow[3], calling it an orange (if a light one) is not insane.
[0] http://www.color-hex.com/color/f12910
[1] http://www.workwithcolor.com/red-color-hue-range-01.htm
[2] http://www.color-hex.com/color/fbcc1a
[3] http://www.workwithcolor.com/orange-yellow-color-hue-range-0...
I see red all around.
> Additionally the 'Analogous Colors' contains an even more obvious orange, and pink, but no sign of red.
Hue-wise, red is in the middle of orange and pink, if your analogous colors are orange and pink your base is a red. That's exactly what you get for scarlet: http://www.color-hex.com/color/ff2400 or pure straight no-frills red: http://www.color-hex.com/color/ff0000
I mean, obviously, the color is blue. Or is it gold? In any case, it's definitely a dress...