Topics

Lostanza types

 

A few questions with regards to lostanza types:

  1. How can I create/represent a 16-bit number?
  2. How do you signify that a number is unsigned?
  3. Can you create type aliases for things like callbacks/pointers

 
Edited

Hi Jake.

There is currently no way to create a 16-bit number in LoStanza. And byte is the only unsigned type in LoStanza currently. LoStanza was originally designed as a way to write low-level code and interface with external hardware. But now we are still deliberating on a major decision: Should LoStanza be able to model all C types and behaviour? I am still unsure. Currently it does not, and hence some FFIs will necessitate writing some glue code in C.

Type aliases are on the roadmap but not yet implemented yet.

  -Patrick

 

In my experience while implementing the regex library, I never really felt the need for LoStanza to be able to model all of the C behavior that I was working on. As long as I could share objects and types across the languages, I was pretty happy.

+1 for type aliases though.

-Sumit

 

What is the reasoning for not supporting (1) and (2)? Or rather, what are the pros/cons that are causing you to deliberate over this? I see unsigned numbers in almost every library I look at. It seems a strange limitation to leave these out. Then also, I'm wondering why skip out on the 16-bit numbers? The short data type is commonplace. Wouldn't any kind of network programming need short and unsigned for various things?

For someone like me who is not an expert C programmer, I feel like LoStanza is just these few pieces short of being a great tool for wrapping C libraries.

 

Hi Jake.

The main difficulty is one of avoiding complexity. Here are some (unorganized) issues that we're mulling over and still require precise answers:

1) If you were completely unconcerned with interoperation with C, then would 16-bit and unsigned types still be a desired feature? I would argue no. Java has similarly made the decision to avoid unsigned types because of the numerous subtle bugs that they cause. 

2) If these types are purely for interoperation with C, then is complete (or complete-enough) interoperation with C possible and desirable for LoStanza? There are other issues hindering interoperation with C beyond the lack of unsigned types. LoStanza is missing array types as well, and C libraries that make heavy use of #define macros are not easily modeled in LoStanza. If LoStanza can model C behaviour, then many C libraries can be wrapped without ever writing any code in C. That seems nice. On the other hand, there's a great deal of C++ libraries as well, and those will necessitate writing a C wrapper first anyway. 

3) There is currently a HiStanza type corresponding for each LoStanza primitive type. If we add unsigned types to LoStanza, should there be an equivalent HiStanza type?

4) The implicit type conversion rules for LoStanza are currently both very convenient and also quite predictable. I haven't yet run into an implicit conversion bug yet. But the implicit type conversion rules for C are *quite* subtle and bugs arise often. How should implicit conversions be handled in the presence of unsigned types?

Essentially, the main thing we gain from modeling more C types is the ability to wrap C libraries without ever writing a line of C. We are still deciding whether that's a worthwhile goal (since there seem to be just as many C++ libraries as there are C libraries) and whether it is worth the extra complexity cost.

  -Patrick

Kriry
 
Edited

I really feel like LoStanza should be able to model all C types and behaviour.  it will get many power libraries  while it can avoid issues when writing in C ! like Go 、Rust . they are power language ,and also provide close connected C‘s ecosystems 。it is big value for new language.

 

Hi Kriry.

Thanks for offering your opinion. After some more internal debate, we have decided to model a reasonably larger subset of C in LoStanza. We are planning on adding support for:

  - Unsigned Types
  - Short Type
  - Array Types

These additions should allow us to model all C structures, and C functions. C macros will remain unmodeled for now, until we figure out a clean way of supporting them. But I think those additions get us over the hump. Although it's not the goal, this will also allow LoStanza to compete against Go and Rust in system programming.

  -Patrick

Kriry
 

great!  L.B. Stanza have good points i like it : functional programming , full programmatic s-expression , Go less do that.  I‘m a fun of Rebol . it's Metaprogramming and Expressive more power than others. but it is interpretation. with Stanza have enough ability in low Level. it will be a Expressive and power modern language.

krircc@...
 
Edited

As I know. Rust can really replace C. there is also a Redox-os written in Rust.

Kriry
 
Edited

I find stanza's  in some ways like red-lang(inspired by Rebol) Architecture。stanza Compile to LoStanza(write in stanza) then to Machine。 red Compile to red/system(write in red) then to machine. theny also have some similar features and others not. red provide it's own toolchian

 

I checked out Red because I was interested in Rebol a long time ago. It looks interesting! It makes me want to write a reactive gui framework for Stanza as well.

Kriry
 

great! now i use elixir for web at work. i must say it's beautiful. i will want try stanza for GUI and more.

Jackson Drexler
 

Red is nice, it's picked up Rebol's torch and run with it. The homoiconicity of forth and lisp taken to come up with their dialecting concept of DSL's without needing lisp macros. OCaml has great extensible syntax support too. Nim has powerful macros inspired by lisp and meaningful whitespace, but has too many symbols and keywords. It might provide new ideas for interop and per thread heap isolation I'm not sure. Built on nim there is spry, a language that is inspired by rebol and smalltalk with freeform syntax. There are a lot of interesting ideas out there on how to do certain things but Stanza is my favorite and more than that I believe that Stanza has the presentation, leadership, and circumstances to succeed in providing power and usability where other promising languages (like nemerle) have failed to gain traction due to missing one of these factors.

On Aug 10, 2016 7:24 PM, "Kriry" <krircc@...> wrote:
great! now i use elixir for web at work. i must say it's beautiful. i will want try stanza for GUI and more.

Kriry
 
Edited

yes, stanza is more power. Expressive is important . recently elixir obain big Attractive becuase it's functional,Metaprogramming,concurrency and ruby's grammar。it
 is big  Advantage for web and service (they need power concurrency and Scalable).stanza has all this features. even more power maybe more Scalable. i don't think stanza should use LLVM . now many language use it for seepd and obain Advantage at begin. but it's  Introducing complexity and Contribution difficulty 。 i think go language do it right , don'st Introducing complexity is good for future development and people can quickly pick up then easy Contribution. everyone like use favorite language do things.

 

Thanks for the kind words. Stanza's a young language still, probably one of the youngest, but we have already gotten significant productivity gains from switching over to implementing our software in it. There's more optimizations, LoStanza language features, a REPL, and other additions on the roadmap. New features will be announced on News page.

  -Patrick

 

Patrick,

Any update on when these new LoStanza types will land? Been exploring writing some bindings lately and would greatly appreciate having a short type and unsigned types.

~ Jake

 

Hi Jake.

We've had some meetings to figure out some design questions but have yet to start implementing. Currently we're busy with getting some of the optimization transforms done which will speed up both user code and compilation times. The new LoStanza types are probably a few months out still before they hit a stable release. I would suggest working around it for now, and then incorporating the new types when they become available. Hopefully they're not a show-stopper.

Cheers.

-Patrick

Previous Topic Next Topic