Lartu / ldpl

COBOL-like programming language that compiles to C++. With serious dinosaurs with neckties and briefcases 🦕💼
https://www.ldpl-lang.org/
Apache License 2.0
158 stars 24 forks source link

Experimental new nested type syntax. #158

Closed xvxx closed 4 years ago

xvxx commented 4 years ago

Just an idea I had, since the backwards nesting of multicontainer type names is a bit confusing to me.

What if instead of this:

DATA:
  groceries IS number list
  names IS text map

you could do this:

DATA:
  groceries IS list of numbers
  names IS map of text

And instead of this:

DATA:
  myVariable is text list list
  myOtherVariable is number map list map map list map
  pleaseStop is text list list map list list map map map list map map list

You could, but should never, do this:

DATA:
  myVariable is list of list of text
  myOtherVariable is map of list of map of map of list of map of number
  pleaseStop is list of map of map of list of map of map of map of list of list of map of list of list of text

This branch adds support for the nesting, keeping the current method for backwards compatability.

Maybe a bit buggy, wanted to see if people thought this was an improvement before ironing it out.

Lartu commented 4 years ago

Wonderful :smile:! This is what I was actually thinking of when I implemented multicontainers, but then it was easier to implement what I ended up implementing. This is wonderful and I love it! Maybe we could even allow maps as an alias of map and lists and numbers and texts or whatever so plurals can be consistent. Not a priority, though (and should be discussed first).

That said, does this work with sub parameters? At the moment we are having a bug with multicontainer parameter passing and I would not like to add more logs to that fire until it is off :point_right::point_left: have you tested that by any chance?

I will of course accept this PR 'cuz I love it, but if the error stated above persists, I'd like to wait just until that is fixed.

xvxx commented 4 years ago

This is what I was actually thinking of when I implemented multicontainers

Oh, fabulous!

That said, does this work with sub parameters? At the moment we are having a bug with multicontainer parameter passing and I would not like to add more logs to that fire until it is off 👉👈 have you tested that by any chance?

I have not tested it very thoroughly at all, no. I will check this out in the next few days and report back. Better to hold off until things are fixed, I agree :+1:

Lartu commented 4 years ago

Wonderful @dvkt! Should I merge this then?

xvxx commented 4 years ago

@lartu It should be ready to go - I added some basic tests in https://github.com/Lartu/ldpltest/pull/19

Lartu commented 4 years ago

Wooooooooooonderful, @dvkt! In it goes!

Lartu commented 4 years ago

Thank you very much!

Lartu commented 4 years ago

When you have some free time please document these new features, @dvkt! :smile: