A small dive into, and rejection of, Elm
medium.com
medium.com
The author didn't find a built-in function to construct a list of option tags from a list of strings, so, instead of building their own... they copy pasted all the strings and manually built the option tags one by one. They could have collapsed that into a one-line `map` call.
Elm is young and has a long way to go: it is definitely missing many of the conveniences that a web framework will give you (such as functions for building forms from data). Personally, I miss typeclasses coming from Haskell. But it is a Haskell/ML-influenced language before it is a web framework, so for a while anybody using it should expect to be building more of their own plumbing.
Maybe I'm being presumptuous, but the author's approach seems like the kind of error fairly junior programmers make all the time: "if there's no function to do it for me, it can't be done, I'll copy-paste". That's a teachable moment. It's too bad if trying Elm when they didn't have the experience to build their own plumbing turned them off from that kind of approach: I liked Elm for a side project, and am hoping to try similar approaches like PureScript in the future. Getting the "if it compiles it probably works" experience on the front end is addictive.
Can you show your one line map call youre talking about
I think this is a pretty pedantic reason to dismiss a language, personally.
Granted, though, there aren't many languages that can handle that. As far as I can see, it requires compile-time code execution.
I really wanted to create a spec for the data in app-state, and check the value in the app-state atom each time I edited it (perhaps with an add-watch). That gets you many of the same advantages of static typing, but you only add the extra insurance when you think its worthwhile instead of always.
Instead of using strings for time-choices and page-choices (in the code at [1]), you can use maps like
[{:title "Day" :time 24}, {:title "Hour" :time 1}...]
and expand when nessicary. It shouldn't be too difficult to keep them in sync this way.You might want to check out clojurescript again sometime soon. Clojure.spec (and cljs.spec) are going to offer a huge jump in usability. Clojure.spec is a tool kit, and specs are basically definitions of data, that can be used for parsing, unparsing, and generating that very data. The beginning of this (interactive, cljs driven) blog post shows clojure.spec off a bit.
[1] - http://escherize.com/cljsfiddle/#gist=eea10854f99ef124f8dc15...
[2] - http://blog.klipse.tech/clojure/2016/10/10/defn-args.html
(I offer this as no criticism of anything, just in the hope it might save a single other soul the same confusion I had.)
So two red flags. Author wanted to replace an existing tech with another buzzword tech he has never worked with. And the author immediately choose the wrong data type, likely because it was different.
I do agree though, if a web framework cannot easily do forms, its not very useful.
I would like to encourage the author to revisit the 'timeRangeFromString' function and consider wrapping the result in a Maybe or Result, as this is exactly the type of function that is not guaranteed to deliver a result. With strongly typed languages like Elm it is best to use the type system to one's advantage, and not fight against it.
That is not to say that everyone should like Elm or similar languages, but they require you to shift the way you think about how you structure types.
I've only briefly looked at Elm so far, so I'm not sure how much of an issue this is or isn't in real code. However, I'd like to point out that Javascript (without jquery or other frameworks) also doesn't have any selectbox support besides the built-in HTML ones (which aren't very flexible). I even wrote my own yesterday. Took about 100 lines of JS (no dependencies). I've written similar code in ClojureScript.
I know that the complaint is that the author had difficulties building a select/dropdown. Maybe its harder in Elm than in JS or ClojureScript for some reason, which is a shame if true, but it can't be thaaaat hard, can it?
Of course, Elm is still really young, so its possible it does, indeed, still need a bit more polish to make it truly useful.
Now, all that being said, i'm not familiar enough with Elm to know if he's actually right or if there is a better way to do what he wants. But that is what I think the crux of his point is.
Reddit: https://www.reddit.com/r/programming/comments/5bsanc/elm_is_...
I found it interesting because I have not myself looked into Elm yet but kept it in the back of my mind to do so some day, since thus far I only ever read extremely positive opinions.
The problems encountered in these two articles are similar to problems that used to plague me. I would want to get something in C++ that was like the way I thought it was done right in Modula-3. The C++ feature was almost but not quite enough like M3 to make it work. I would get frustrated and say that everyone was a moron and programming is doomed. Sometimes I'd even drop the project entirely. This sort of thinking made it impossible for me to use MFC.
At some point I just realized I needed to get along. Working in Java (1.1), I started doing things with heavy boilerplate if it was required. You simply can't use a tool against how it was designed. I guess Elm doesn't have the word "opinionated" in its documentation enough, because that's what saved Rails. People would be like "DB2 doesn't do those big column names" and Rails people would be like, "Yup. We're opinionated about databases too." Nevertheless, if you don't fight the basics of the system, you get stuff done quickly.
> a language that seems to inherit not just nice types and largely ok or even nice syntax from Haskell but also a stubborn approach to prefer (imagined) purity over practicality [...]
Why "imagined"? I do think that prohibiting side-effects is a good thing. I'll be the first to admit that I'm not actually good at writing pure code that's easy to grasp, but I imagine that to be a lack of practice, just like w/ OOP.
Bottom line is that I don't get why people pick up a functional language, which also happens to be in development, and then bash it for being a functional language and not yet ready for production. This seems like pointless bashing.
You'd have the same problem in C, without pre-processor abuse (which is how I've fixed this in the past), but I'd not want that problem in a modern language.
I bring this up to suggest that this isn't necessarily a core limitation of ML languages like Elm, just a feature that Elm could borrow from Haskell in the future to address this problem without sacrificing typing.
[1]: https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-D...
Searching elm-discuss for <2 minutes.
HTML selects do allow duplicate names. He'd be better off just using a dictionary or list of name/value pairs and forgoing the union type altogether.
I don't claim that React is the end all be all, it has a few trade-offs.
The first thing that isn't ideal is that it has a fair amount of boiler plate that's kind of unavoidable: reducers, actions, mapStateToProps, mapDispatchToProps
Also, the size of React and React-Dom (which is required) is quite large, although with minification and gzipping it's not as bad.
It also has a pretty big learning curve when you're first getting started.
On the plus side, it's very performant, concerns are separated well and it scales well. Once you're up and running and familiar with how things work, it's a pretty nice environment to develop in.
I've replaced lodash with ramda and that has been a pleasure.
Also, JSX is really nice. It's nice to use a full-blown markup language that's pretty much HTML, and to use JavaScript. That beats trying to fit every abstraction you need into a template engine.
I haven't done much experience with Elm, it seems nice, especially since I've started to program more functionally. I would consider using it on my next project.
I use Elm more as a way to write components on a server rendered page and it works for great this way! The eco-system is too small to think about creating complex SPA at this point but I really like the language and hope it matures well.
Crap article with not much thought behind it. sigh...
I personally find elm pretty compelling, and look forward to using it in some distant future when I touch web frontends.
You seem apparently unaware that nowhere in elm's website it says that, and in fact it totally implies the opposite "A delightful language for reliable webapps".
Definitely sounds like the Elm team think it's ready for prime time.
Major.Minor.Patch
So 0.1.7 would be semantic, but 0.17 would not be.