Re: Prelim question about Stanza type interfaces


 

Hi Gottfried.

Thanks for your interest in Stanza! To quickly answer your first two questions:

1) Stanza uses multimethods and the defmulti construct to define the interface with which you interact with values of a certain type. The only thing that is currently missing in the current language is a compile-time check that enforces that an appropriate method has been implemented for every type. Currently you get a runtime error that says "The multi plus have no appropriate methods for arguments of type (String, Int)". The compile-time check would be nice to have and we are working towards it, but we have found that the runtime errors do not substantially hinder programmer productivity.

2) A struct can hold any value as its field, including lambdas. I would encourage studying Stanza's multimethod system to see whether you really need it however.

As for your comparisons of Stanza to the other languages, let me start with the family of languages Idris, Isabelle, Coq, Agda, etc. These languages have a strong culture of enforcing correctness and provide an extensive toolkit for accomplishing that. Stanza will never be able to replace these languages for this purpose. I designed Stanza to be a pragmatic practical language to use to attack common programming problems. In daily programming, "correctness" is important but not the only important or difficult aspect of software. For example, I used to program video games. The most important quality of a video game is to be "fun". Isabelle's type system will not help me design a "fun" video game, and on the contrary, will actually substantially hinder my productivity. My sense is that most daily programming is quite similar to programming a video game: correctness is not the most important metric.

Stanza is more aptly compared to Scala, Rust, Dart, Typescript, Python, Haskell, C++. To make these comparisons, I personally choose the implementation language by deciding upon the minimal acceptable performance requirement, and then remove all languages that do not meet that performance requirement. Among the languages remaining, I choose the most productive language among them. There is no reason to use C++ unless you require C++ level performance. Similarly, there is no reason to fiddle with a non-garbage-collected language like Rust, unless you require performance levels exceeding garbage-collected languages. Among the languages above, Stanza is very well regarded in terms of its productivity, and its performance is steadily improving.

  • Patrick

Join lbstanza@groups.io to automatically receive all group messages.