#ruby-offtopic - 02 January 2018
« Back 1 day Forward 1 day »
[14:56:55] apeiros: $deitiy damit, I have to fix my bash prompt for git repos without any commits (fresh repos)
[15:07:19] dminuoso: It's a very simple idea that gives you a lot of expressivity in the type system.
[15:10:03] apeiros: I haven't worked with them, though. mainly because other than ruby, js, C and C++ I didn't use any language
[15:12:11] dminuoso: apeiros: So depending on your compiler and the version, this can easily give you up to 300 lines of error messages.
[15:15:54] apeiros: I assume the trait is related to sort being able to sort a varying set of types, in this case, a list?
[15:16:34] dminuoso: apeiros: Well the issue is list is not a random access container (because its a doubly linked list) right?
[15:17:05] dminuoso: C++ template system has no sensible way of expressing whether a given type satisfies an interface by implementing certain methods.
[15:18:47] dminuoso: In a way traits let you express an interface like Enumerable by requiring any type that claims to fulfill the interface to actually implement it.
[15:19:17] dminuoso: With higher kinded types you can do this trick with an additional degree of freedom
[15:20:50] dminuoso: C++ has higher kinded types though due to a not-well known part of the template system where you go: template <template <typename> class M> ...
[15:35:22] apeiros: I'm not used to functional languages. well, I'll see how it plays out. but it strikes me as a rather bad/confusing idea. probably the less experienced a coder is, the more confusing.
[15:38:42] dminuoso: apeiros: Probably yeah. At any rate, traits are a type safe way to do things like Enumerable or Comparable in Ruby. :)
[17:16:30] havenwood: dminuoso: chruby users don't seem to have PATH-related problems, but I think they're just more likely to know their way around a terminal, know what env vars are, etc.
[17:17:31] dminuoso: havenwood: It's silly even to just look into chruby and see how it works. Took me just under 3 minutes.
[17:30:45] havenwood: dminuoso: https://github.com/rvm/rvm/blob/master/scripts/extras/chruby.shhttps://github.com/rvm/rvm/blob/master/scripts/extras/chruby.sh
[17:33:41] havenwood: oops, double-pasted: https://github.com/rvm/rvm/blob/master/scripts/extras/chruby.sh
[19:17:01] apeiros: from the top of my head it seems rust and swift take the same (or very similar) approach to null/nil types
[19:31:07] dminuoso: apeiros: Yeah. Typetheorywise it's just a sum/coproduct type if you've heard of that.
[19:32:18] dminuoso: It's neat in that the type system forces you to acknowledge and deal with the possibility of null.