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

? modifier #104

Open
Mouvedia opened this issue Jul 2, 2013 · 1 comment
Open

? modifier #104

Mouvedia opened this issue Jul 2, 2013 · 1 comment

Comments

@Mouvedia
Copy link
Member

Mouvedia commented Jul 2, 2013

//if this object wasn't previously set this would set it
@object ? name { … }

@value example { keywordA }
@value example2 { … }
   & ? example { keywordB }

//this would use keywordA since example was already set
property: example;

It's quite useful when you rely on third party hss.

alternate proposal

Since we can't start an object name wth a ? we could either get rid of the space or make it optional.

@object ?name { … }

concequense

//since
#new name { … }
//is equivalent to
#new @container name { … }
//then
#new ? name { … }
//is equivalent to
#new @container ? name { … }

Which means that the ? will be scope aware when used with the new instruction and that this construct will replace the ensure instruction.

//example with several elements
#new @container elementA & ? elementB { … }
//is equivalent to
#new elementA & ? elementB { … }

PS: depends on axr/core#190

Question

//should we allow
?@object nameA & nameB { … }
//to resolve to
@object ? nameA & ? nameB { … }
//which would mean we would also have to accept
!#support (A) & (B) { }
//which would be equivalent to
#support !(A) & !(B) { }
@Mouvedia
Copy link
Member Author

Coffeescript has the existential operator and Roole has the conditional assignment operator ?=.

It's also pretty useful to set a default fallback placed after in the source. So for example if an user chose not to do something we would have a default dynamically set afterwards.

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

No branches or pull requests

1 participant