Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possiblity of adding Struct to nolol #62

Open
Woccz opened this issue Jun 19, 2021 · 4 comments
Open

Possiblity of adding Struct to nolol #62

Woccz opened this issue Jun 19, 2021 · 4 comments
Labels
backlog Good idea but bad effort to value ratio right now enhancement New feature or request nolol Issues only regarding NOLOL

Comments

@Woccz
Copy link
Contributor

Woccz commented Jun 19, 2021

Following #48/#63.

Perhaps give programmers the ability to create Structs in nolol, as almost a precursor to classes.
These Structs would make it easier to group related variables and would be treated as a programmer-defined type, similar to C, and could be passed to macros which act almost as a class method.

No actual YOLOL operations can be performed on a Struct, only on its child variables.

Early into compilation all Structs can be removed and their child variables be replaced by locals, as Struct is merely a way to improve readability, understandability, and reusability of nolol code.

An example of a potentially useful Struct, that could even be included in the "std" library is:

Struct 3DCoordinate
    Num x
    Num y
    Num z
end

I'm sure there would be many other possible uses for Struct.

Thank you.

@Woccz Woccz added the enhancement New feature or request label Jun 19, 2021
@dbaumgarten
Copy link
Owner

Especially when combined with macros this would make some things pretty simple.
For example the matrix-math used in ISAN.

When designing the type-system it should be done in a way that it is prepared for the future addition of structs.

My only concern is, that it might make nolol harder to learn for beginners.

@Woccz
Copy link
Contributor Author

Woccz commented Jun 20, 2021

I'm not sure why it would make nolol harder for beginners, as you can still use all the code without ever touching structs, can you not?

@Woccz Woccz changed the title [Backlog] Possiblity of adding Struct to nolol Possiblity of adding Struct to nolol Jun 20, 2021
@dbaumgarten
Copy link
Owner

Probably depends on how much structs are used in the standard-library.

Its not really that I think this one specific feature will make it to complicated. It's more a general feeling that if every feature that somehow makes sense gets added, nolol will eventually become a horrible mess.

(This is not a "no" to structs. I just want to be careful about feature-creep in general.)

@Woccz
Copy link
Contributor Author

Woccz commented Jun 21, 2021

I see. Perhaps structs could be kept to their own, higher-level part of the standard library so that beginners do not have to deal with them.

I think nolol having many features is a good thing, however they should probably be built in layers to allow for the user to choose what level they wish to use nolol at.

I think nolol does a great job of this currently, by still allowing goto, despite having built-in loops, and features such as macro are only for those who wish to delve into them.

If nolol continues to implement new features with this downward compatibility principle, I believe it will become a language that is easy to pick up for beginners, yet offers helpful functionality for specific applications.

@dbaumgarten dbaumgarten added the nolol Issues only regarding NOLOL label Jun 25, 2021
@dbaumgarten dbaumgarten added the backlog Good idea but bad effort to value ratio right now label Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Good idea but bad effort to value ratio right now enhancement New feature or request nolol Issues only regarding NOLOL
Projects
None yet
Development

No branches or pull requests

2 participants