Re: Prelim question about Stanza type interfaces

Gottfried Barrow <igbi@...>


Unless I try to lock into Stanza and need some help, any further email in this period of mine can be considered noise. But new project forums can need some noise to show that the project is active, and is being supported. The landscape of new programming languages, discovered by means of Google, is a landscape of dead carcasses, many having been left to die in a reasonably mature state.

People who don't know much can still be looking for very specific features, so if I think I need something, others may also be looking for it.

I do actually have two questions.

Q1) I got as far as running 'stanza install -platform windows -path', which produced the '.stanza' file. I got a line in the file like this:

  install-dir = "E:\\E_1\\02-p\\3zz\\(stanza)\\00_wstanza_0_11_10"

Can I change that to a relative path? I'll find out, but even if I can, there's the question "Am I supposed to be able to change that to a relative path?".

My distribution needs to be portable. I zip up my working folder, which contains multiple 3rd-party distributions. People would then simply unzip my file on a Windows machine, in any folder, with spaces allowed in the path. My binaries would then just work. No magic installs. No lengthy "do this and that". Simplicity counts for a lot.

There are some distributions that allow for that simplicity, like Dart, Node.js, and certain MinGW-w64 distributions, but many that don't, recent ones being Kotlin, and the MinGW-w64 distributed with Idris. It's a sad day when I work hard to make sure spaces can be used in paths, but the pros don't.

Q2) Is there a "chaining substitute" operator? Instead of 'f(x)', I'd like something like the usual 'x |> f'.

*Noise: concerning multimethods*

You can thank Julia for warming me up on how to make the switch from object methods to multimethods. Central to all my types are enforcing a domain, using a domain predicate. For example, like in many languages, it appears you only give me 'Int', rather than a large selection of signed and unsigned ints, arbitrary-size and fixed-sized integers. So I would 'Int' in a struct (call it 'Nat'), and use the domain predicate 'x >= 0', which a multimethod would retrieve.

The predicate 'x >=0' would be hard coded for 'Nat', so I assume a multimethod would work for that, and be desirable for that.

However, I  'Nat' would be extended to take a "domain restriction predicate argument", predicates like "x > 24 && x < 42".

*Noise: concerning innovative products and the-future-mathematical-programming-language-of-the-masses*

Innovative products will be used in ways the developers never dreamed of.

Suppose the world's use of languages converges to one programming language, "the mathematical programming language of the masses". What might that programming will be like? Most likely, our imagination, at this point, would get it wrong.

I guess at one point, I thought Haskell had to be the-future-mathematical-programming-language-of-the-masses, but I don't see the masses jumping on the Haskell band wagon, and now I don't even want to use it. Why? I don't explain, for the purpose of noise reduction. As a member-of-the-masses, I know Haskell is great, but I don't want to use it.

*Noise: trying to solve the problem of bridging the mathematical-lanuage gap*

There's ZFC-based math, and then there are programming languages.

It's a free-for-all, so I'm interested in trying to solve the problem of unifying the languages of two different disciplines, math and computer science, where, currently, people mostly work very different.

I don't want to define an algebraic group twice, once using a combination of English and standard notation, and then again using the syntax of a programming language. I want to do it once, in one language, a technical language that gets processed by a computer, for various reasons, and that can be reasonably read like normal. It doesn't have to be perfect, just acceptable.

*Noise: you have an arrow type, chalk one up for Stanza*

Successful people don't waste their time, so I consider all programming languages to be great, for someone, and indirectly, maybe even for me. I try not to get stupid about criticizing languages.

I'm not current on Julia, but it didn't have an arrow type. Dart also doesn't have an arrow type. You have an arrow type. That counts for a lot, I'm pretty sure.

Julia's abstract type only allowed for subtyping one type. You allow subtyping of an intersection type. I guess that will give me a form of multiple inheritance. I need that, because an algebraic group is both an additive group and a multiplicative group.

*End noise*

In the end, no feature of a programming language magically makes things easy for me. Readable syntax is desirable, but not absolutely essential, because it's not like, "Dude, it's almost like reading English. I instantly understand it all, even though it's massively complex!"

I might have some questions, since I don't know much. If you didn't already have the good amount of documentation you have, I wouldn't have made the noise I've made. Chalk one up for Stanza.

Still, regardless of any feature, common sense tells me not to jump on the bandwagon of any language that hasn't established itself, and isn't backed by big funding of some kind.

But then, I repeatedly get to a point with other language where I say, "Dude, nobody who would want to read through an abstract algebra book will want to wade through this stuff of yours". Not that I've ever gotten to the point of implementing much "stuff". It's all risky, and there's no purpose in developing a library that ends up on the landscape of dead carcass.


On 5/2/2017 4:48 PM, Patrick S. Li wrote:

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 to automatically receive all group messages.