7 ms·
Python to OCaml: Retrospective
- meric 11y agoThank you for the writeup. I loved the charts and the writing.
- detaro 11y agofrom 2014, discussion from back then here: https://news.ycombinator.com/item?id=7858276 https://news.ycombinator.com/item?id=7858276
- aksx 11y agoIs it just me or is there a mistake here http://i.imgur.com/65GPWq6.png http://i.imgur.com/65GPWq6.png He says the color of the UI part is orange but i see yellow
- vog 11y agoColor perception is very subjective, because color learning differs from childhood to childhood. 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.
- lectrick 11y agoFascinating. I see it as yellow. This also hints at the "qualia" mystery...
- hacker_9 11y agoWhilst colour can be subjective, in this case it is clearly yellow and a mistake by the OP, because the preceding bar is clearly orange.
- strmpnk 11y agoDisplay technology also varies quite a bit. Some cheaper devices tend to saturate certain hues like redness. It could very well look a bit more orange on one display and look completely yellow on another.
- joelwilliamson 11y agoThe middle bar looks red to me.
- data_hope 11y agonot everything has to be binary. In fact outside of math and deterministic CS, we hardly have the comfort of being clearly wrong or right. https://www.cs.rit.edu/~rlaz/prec20092/slides/BayesianDecisionTheory.pdf https://www.cs.rit.edu/~rlaz/prec20092/slides/BayesianDecisi...
- masklinn 11y ago> the preceding bar is clearly orange. 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 http://www.color-hex.com/color/f12910 [1] http://www.workwithcolor.com/red-color-hue-range-01.htm http://www.workwithcolor.com/red-color-hue-range-01.htm [2] http://www.color-hex.com/color/fbcc1a http://www.color-hex.com/color/fbcc1a [3] http://www.workwithcolor.com/orange-yellow-color-hue-range-01.htm http://www.workwithcolor.com/orange-yellow-color-hue-range-0...
- hacker_9 11y agoFrom your link, compare the red RBG bar to the clearly orange bars at the side of the screen. Additionally the 'Analogous Colors' contains an even more obvious orange, and pink, but no sign of red.
- masklinn 11y ago> From your link, compare the red RBG bar to the clearly orange bars at the side of the screen. 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 http://www.color-hex.com/color/ff2400 or pure straight no-frills red: http://www.color-hex.com/color/ff0000 http://www.color-hex.com/color/ff0000
- myst 11y agoLooks yellow to me.
- Symmetry 11y agoThis xkcd color name survey seem apropos. http://blog.xkcd.com/2010/05/03/color-survey-results/ http://blog.xkcd.com/2010/05/03/color-survey-results/
- kazinator 11y agoThere are oranges which have that color, but I wouldn't buy one.
- melling 11y ago"Most errors are picked up by the type checker immediately at the start of the build, rather than by the unit-tests at the end. That saves a lot of time." 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?
- testcross 11y agoYes, you can have a look at merlin: https://github.com/the-lambda-church/merlin https://github.com/the-lambda-church/merlin
- krat0sprakhar 11y agoMerlin for Vim is an absolute delight to use. You get auto-complete, indentation, compile-on-save, type checking right within your editor with less than 5 lines of configuration. 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 https://twitter.com/prakharsriv9/status/689141428161802241
- mercurial 11y agoAlso, destructuring for pattern-matching is pretty cool.
- krat0sprakhar 11y agoIt surely is. But how does Merlin help with that?
- mercurial 11y agoLike that: http://the-lambda-church.github.io/merlin/destruct.ogv http://the-lambda-church.github.io/merlin/destruct.ogv Really nice.
- systems 11y agoats , hmmm never heard of it, seems to have done really well, whats the catch?
- masklinn 11y agoIf you read the original article[0] it did very well on the speed/size bench (5/5) but took a big hit on ease of writing (1/5) ending up with 48 between C# (47) and Haskell (49) and the following summary note: > 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-replacement-for-0install/ http://roscidus.com/blog/blog/2013/06/09/choosing-a-python-r... [1] http://roscidus.com/blog/blog/2013/06/20/replacing-python-round-2/ http://roscidus.com/blog/blog/2013/06/20/replacing-python-ro... [2] https://github.com/githwxi/ATS-Postiats/wiki/ATS-implementations#ats1 https://github.com/githwxi/ATS-Postiats/wiki/ATS-implementat...
- aikah 11y agoWhat about OCaml and concurrency ? what are the options out there ? after reading : http://roscidus.com/blog/blog/2013/09/28/ocaml-objects/ http://roscidus.com/blog/blog/2013/09/28/ocaml-objects/ the language sounds quite interesting. Does it support something like channels ?
- krat0sprakhar 11y agoOT: Yaron Minsky has a rather interesting view on concurrency in OCaml. Do checkout his latest interview on SE Daily - http://softwareengineeringdaily.com/2015/11/09/automated-trading-and-ocaml-with-yaron-minsky/ http://softwareengineeringdaily.com/2015/11/09/automated-tra...
- masklinn 11y agoLWT (a popular IO library) has channels: https://ocsigen.org/lwt/dev/api/Lwt_io https://ocsigen.org/lwt/dev/api/Lwt_io That's what TFAA (and MirageOS) use.
- vog 11y agoForgive my ignorance, but what is TFAA? All my web searches yield irrelevant results, such as "Triveni Faridabad Allottees Association" or "Trifluoroacetic anhydride".
- 11y ago
- tempodox 11y agoWas a great writeup before, now even enhanced. +1.
- mands 11y agoGood to see this back up on here - am just about to start porting a Python codebase to OCaml myself (www.stackhut.com) and have been reading this to help. Am thoroughly looking forward to all the typed, functional goodness :)
- elbasti 11y agoExcellent writeup. It's a very useful example of a refactor done right. I'd love to know more about the json interface between the Python and OCaml code, since "integration" is usually where refactors like this get hard.
- pmarreck 11y agoThis seems near-proof to me that a gradual inflight translation of a codebase from ANY one language, to another, entirely different one, is feasible, as long as you build a data interop layer of some sort (JSON, etc.). I imagine that if it were powering a web app, dual-deployment would become an additional (but potentially manageable) concern during the "transition" period. 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.
- e_d_g_a_r 11y agoI think rewrites are seldom worth it, no need to rewrite everything causes it not in your favourite language (Looking at you JS land)
- wwweston 11y ago> as long as you build a data interop layer of some sort (JSON, etc.). I imagine that if it were powering a web app, dual-deployment would become an additional (but potentially manageable) concern during the "transition" period 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."
- 11y ago
- dorfsmay 11y agoI'd love to see a comparison with recent Rust. Looking at that graph with 2013 results, I'm surprise how much slower Rust was compared Haskell and OCaml.
- steveklabnik 11y agoFor fun I started porting the example over: https://gist.github.com/steveklabnik/f86cba4da1dc9c5c68e0 https://gist.github.com/steveklabnik/f86cba4da1dc9c5c68e0 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.
- masklinn 11y ago> 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. 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)
- steveklabnik 11y agoAh that makes sense. Oh well.
- NelsonMinar 11y agoI regularly use another OCaml program: Unison, the file syncer. It's sort of like a bidirectional rsync. It's a fantastic tool but nearly abandonware. My suspicion has always been the open source project languishes because so few people know OCaml to work on it.
- massysett 11y agoIf it's a fantastic tool, does it matter if it's abandonware? Is nobody working on it because it does what it's supposed to do, is reasonably bug-free, and so it needs no work?
- k_bx 11y agoIn order to not become abandoned, open source software needs to be not only open source, but also to have easily accessible source control, issue tracker and other community-required tools. 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 https://www.youtube.com/watch?v=Y2jQe8DFzUM
- mehrzad 11y agoHow does it compare to syncthing?