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

Declare an individual property #126

Closed
fredrikr opened this issue Jul 29, 2021 · 2 comments
Closed

Declare an individual property #126

fredrikr opened this issue Jul 29, 2021 · 2 comments

Comments

@fredrikr
Copy link

When writing a library extension, you often need to add a property. Since common properties are in limited supply, you typically want to let the user decide if it should be a common property or an individual property. So, you leave it to the user to either declare it or not declare it. This has the problem that if the user includes the extension, without actually using the property, they get a compilation error. This is ugly and unnecessary. What I would like is a way for extension code to declare an individual property. Something like:

#Ifndef cuddliness;
Property individual cuddliness;
#Endif;

If the game author has already declared this as a common property, nothing happens. If they haven't, it's declared as an individual property.

(In Glulx, which IIRC doesn't have individual properties, this would just define a normal property)

@erkyrath
Copy link
Contributor

erkyrath commented Jul 29, 2021

There is already a way to declare an individual property, using a dummy object.

Object dummy with cuddliness;

I suppose this is an undesirable waste for V3 games, though. The suggestion makes sense. But I think we need to be careful that

Property individual;

...remains a valid declaration of a common property. (Might as well support "Property long;" and "Property additive;" too! Those are currently impossible to declare.)

(In Glulx, which IIRC doesn't have individual properties, this would just define a normal property)

The Glulx veneer distinguishes between common and individual properties, and you declare them the same way on both VMs.

@fredrikr
Copy link
Author

Indeed, this is more important for z3 games.

The syntax doesn't have to look like that, but I think it makes the most sense to either use:

Property individual cuddliness;

or

Property cuddliness individual;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants