5 ms·
Says it supports Functional programming, but I don't really see functional features. Seems premature? I see what the goals of Gravity are, but are there any r
by bpicolo 10y ago
Says it supports Functional programming, but I don't really see functional features. Seems premature?
I see what the goals of Gravity are, but are there any reasons I want to use it?
Side note: not a huge fan of implicit self, i.e. class methods automatically referring to "y" as the instance variable "y". I realize c# and Java do it, but worrying about name elision at all is something I'm not a fan of. From an ergonomics perspective, it makes editor autocomplete features slightly worse, as a prefixed "this" or what have you can give it additional context vs "anything in scope"
- Vosporos 10y agoSomeone need to write a functional language for that VM :p
- Tloewald 10y agoIt supports closures and higher order functions. The sample code doesn't show any of it. It basically looks a lot like a subset of Swift designed to allow someone familiar with Swift to get going faster with Creo. Creo looks interesting mainly as a better integrated development experience than XCode provides.
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- catnaroek 10y agoClosures and higher-order procedures do not a functional language make. It has to be convenient to implement procedures that compute actual mathematical functions. Assume there exists a (pure) function `f` and a list `xs`. Does the following expression always return `true`, or, at least, never return `false`? map(f, xs) == map(f, xs)
- tomp 10y agoBy this criterium Ocaml isn't functional either. Hell, even Haskell's not!
- catnaroek 10y agoBy this criterion, both Haskell and ML are functional. If you attempt to compare values whose type doesn't support decidable equality testing, you get an error, either at compile time (Haskell, Standard ML) or at runtime (OCaml, arguably a design defect). And, if `f` is a pure function whose codomain supports decidable equality testing, then `map f xs = map f xs` (or double equals using Haskell syntax) is always true.
- kevinnk 10y agoλ> map acos [2] == map acos [2] False :: Bool Interesting.
- catnaroek 10y agoAh, yes, there's a problem with `Float`s in Haskell. There should be no `Eq Float` instance. Standard ML handles this properly: > map Math.acos [2.0] = map Math.acos [2.0]; poly: : error: Type error in function application. Function: = : ''a * ''a -> bool Argument: (map Math.acos [2.0], map Math.acos [2.0]) : real list * real list Reason: Can't unify ''a to real list (Requires equality type) Found near map Math.acos [2.0] = map Math.acos [2.0] Static Errors
- tomp 10y ago> And, if `f` is a pure function whose codomain supports decidable equality testing, then `map f xs = map f xs` (or double equals using Haskell syntax) is always true. This statement is true in any language. So it's useless as a criterium for determining which language is "functional" and which isn't. Edit: except, of course, Haskell - `xs` could be infinite, in which case the expression wouldn't be true (but bottom instead).
- pvg 10y agoWhat do you mean by "class methods automatically referring to "y" as the instance variable "y". I realize c# and Java? do it". Neither C# nor Java even use the terminology 'class method'.
- bpicolo 10y agoSure they do? https://msdn.microsoft.com/en-us/library/ms173114.aspx https://msdn.microsoft.com/en-us/library/ms173114.aspx https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html https://docs.oracle.com/javase/tutorial/java/javaOO/methods.... Unless the goal is to be overly pedantic and claim "method" is the term vs "class method". Take a look at the Vector example. "y" in the constructor and other methods refers to instance variable y on the Vector class instance.
- pvg 10y agobe overly pedantic and claim "method" is the term vs "class method". That's not me being overly pedantic, that's you misusing standard terminology. The term "class method" has a specific meaning that's quite distinct from "instance method" - the thing you're actually talking about. In fact, if you go to the docs of the very language this post is about: https://marcobambini.github.io/gravity/classes.html https://marcobambini.github.io/gravity/classes.html You'll find verbiage about 'class methods', again, as distinct from 'methods'. I can't think of an OO language or context in which 'class method' to just mean 'instance method' would make any sense.
- bpicolo 10y agoSure. Does not seem that difficult to infer from context what I was referring to, but you're technically correct. The terms are not that far off from each other in either definition or literal wording.
- pvg 10y agoI honestly had no idea what you were talking about. The terms are near-opposite in meaning and usage.