I'd really like to see an snippet in the front page. There are some samples in the tutorial, but I like to see an example to get some feeling of the language. For example, a mix of (define (factorial n) (if ( and ;; here the type of y is inferred (fn ([x : int] y) (+ x y))
Good idea, thanks! I'll try to come up with something representative.
Kashmir: A statically typed Lispy language compiling to Go
41–50 of 75 posts
Re: Kashmir: A statically typed Lispy language compiling to Go
#42I'd really like to see an snippet in the front page. There are some samples in the tutorial, but I like to see an example to get some feeling of the language. For example, a mix of (define (factorial n) (if ( and ;; here the type of y is inferred (fn ([x : int] y) (+ x y))
Good idea, thanks! I'll try to come up with something representative.
Re: Kashmir: A statically typed Lispy language compiling to Go
#43Can you please give one reason to name the project "Kashmir"?
Why not?
Kashmir resonates very strongly and has strong meaning for a significant % of the world's population. Think about coming up with a name like "Crimea" for a language if it has no connection whatsoever. If it does, that's great, may be the author can draw the connection to it on the website.
Re: Kashmir: A statically typed Lispy language compiling to Go
#44Re: Kashmir: A statically typed Lispy language compiling to Go
#45One of the things I'm not sure you're looking at, and that you really ought to decide sooner rather than later, is how much interaction with Go itself you want. You very much do not want to leave the Go FFI interactions until the end.
In fact I daresay this is a critical decision that needs to be the next thing you really spend a lot of time thinking about, because a Kashmir that has a very poor Go FFI leaves me little reason to prefer it to Haskell, or Liskell if you want to get closer to Lisp. (Truthfully, reading over your goals & features, this sounds closer to Haskell than a Lisp, except in syntax, so I'm going to use Haskell as my benchmark.)
However, many of those goals and things in the type system will be at odds with having a simple Go FFI. If all functions in Kashmir are auto-curried, then Go has a hard time calling in to them, with a clumsy syntax and probably slow performance. If Kashmir's type system ends up complicated enough that the Go type system can't express Kashmir function types at all, then Go can't call into Kashmir at all, or some complicated "generic instantiation" step will be required. On the other side, you have to worry about data structure compatibility, too; if Kashmir data structures don't have a nice mapping to Go data structures then Kashmir is going to have a hard time calling into Go code.
Also, I'd suggest before proceeding much farther that you are very, very sure that you understand Hindley-Milner deeply, including what can break it. It offers a lot of inferring power, but at the corresponding cost of laying a lot of very specialized restrictions on your program. These carefully mathematically-specified things often have a way of breaking down the instant you put a toe outside their specified line. (The Haskell community has added things to it that have good bang/buck, but it's always something they have to be careful about.) Go's native type system, for instance, has one huge difference with Haskell that would have me a bit nervous, which is the difference between:
(+) :: Num a => a -> a -> a
type Num interface {
Add(Num, Num) Num
}
Haskell's type there guarantees all the a's are the same Num type. The Num typeclass does not promise that all "Num"s can be added together, only that a Num can be added to other same type things. Go's type system can not guarantee this; that interface in Go is promising that either A: You can hand it any two things that implement Num and it will return yet something else that implements Num which may or may not have any particular relationship to the original types or B: it will panic at runtime. (Or loop forever, I suppose, but it seems strange to be seriously discussing "bottom" in Go at all....)Where in practice you can turn to a programmer and say "Hey, obviously, it makes no sense to add a rational and a Peano integer together, and if you did, you obviously wouldn't expect a BigInt back. So just don't do that.", your type inferencer will not be able to make such assumptions, and if it does, you're right back to the problem that that will raise all sorts of hell in your FFI.
These are not necessarily unsolvable problems! For one thing, there's the sort of degenerate solution of simply not permitting any FFI, and only permitting Kashmir->Go in a very restricted, stereotypical manner that requires a specialized binding step. You could also write off calling Kashmir from Go, if that helps, which is not a bad decision, but is one you should be deliberate about. But I would suggest it is deserving of being the very next issue you tackle, and spend a lot of time thinking about. Go's type system is really, really weak for a static type system, in the sense of what guarantees it is capable of expressing, and trying to cozy that up to a Hindley-Milner system without giving up on a lot on one side or the other is going to be a challenge.
Re: Kashmir: A statically typed Lispy language compiling to Go
#46Can you please give one reason to name the project "Kashmir"?
Re: Kashmir: A statically typed Lispy language compiling to Go
#47What is the advantage of targeting go for a new language project? Could you explain about why this made sense for your project?
* Fast compilation * Very very easy cross-compilation * A pretty good garbage collector * A huge library of easy-to-use libraries (they don't suffer from StringCollectorBeanFactoryProxy-syndrome) * Good concurrency support
Makes sense if you ask me.
Re: Kashmir: A statically typed Lispy language compiling to Go
#48What is the advantage of targeting go for a new language project? Could you explain about why this made sense for your project?
There are so many motivations for this (and so many lisp/go projects that are abandoned). This looks very promising and I hope it takes off. A few of the motivations: * A lisp with an amazing startup time * A lisp that can tap into a big and vivid ecosystem, like Clojure is tapping into Java's and its own * Cross compilation and self-contained binary (I've personally tried doing this with various lisps, and none of t…
Did you try Chicken Scheme?
$ echo "(print \"Hello, World"'!'"\")" > hello-world.scm
$ csc hello-world.scm
$ ./hello-world
Hello, World!
$ du hello-world
16 hello-worldRe: Kashmir: A statically typed Lispy language compiling to Go
#49Despite the fact this post may appear critical, this is in the spirit of feedback to a young language, not a mean spirit. One of the things I'm not sure you're looking at, and that you really ought to decide sooner rather than later, is how much interaction with Go itself you want. You very much do not want to leave the Go FFI interactions until the end. In fact I daresay this is a critical decision that needs to be…
Re: Kashmir: A statically typed Lispy language compiling to Go
#50I understand this project, along with most of the other "Lisp compiling to ..." projects are just for fun, but it's still annoying to see so many of them announced. Half the time it's a stretch to even call them "a Lisp." It's a little silly to call your language a Lisp if it's missing a lot of the stuff that Lisp is associated with. Does this Lisp even support macros? Just say it's a new language that uses s-express…
I agree with the rest of your comment.