-
Notifications
You must be signed in to change notification settings - Fork 0
RSP-1 – AaribaScript Goals and Design #1
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
base: master
Are you sure you want to change the base?
Conversation
|
If you agree, I would like to add a commit to that PR that clarifies the conventions about "effects". I still intend to write a separate PR about them to discuss their use and more broadly their precise definition. Would that be okay for you ? |
|
Please yourself! |
|
If I undestand well the second part of your comment, you want to write a second file, that is a separate RFC, dedicated to Lycan effects? |
|
Yeah, you understood me correctly. I think it has many specifics that are non-relevant for this RFC like their creation / management. |
|
Indeed! About that RFC, I will wait your commit before writting my own updates. |
|
I just realised while working on the rule-editor that our little script language should have a name. So far I opt for: RuleScript. |
|
That's a very descriptive name! As a reminder, we decided the project should be called Thanks for the commit. I will try to add my own proposal as soon as possible. |
|
Oh! I completely forgot about that one! Yeah it is much more natural to call it like that. I'll refactor my classes for the rule editor. |
|
Okay, so a busy week is coming. I will try to push my modification as soon as possible (probably tomorrow), but I cannot make any promises. |
|
I just realized while working on the |
|
My first through was “of course, we need to have scoped variable”. And then I realized that in AaribaScript, definition matter and is testable so... Well, I don't know. I fear scripts will be less readable if we follow the javascript way. |
|
I tend to agree. To be fair adding Would you mind if I edit the RSP to add mention of it in the Execution Model section? |
|
Before doing that, we should probably think about how to get out of a scope. If we don't have any way of getting this "dmg" local variable out of the scope (and I don't want to use a global for this), then we would have to entirely duplicate the code in each of the branches. |
|
One can simply write: dmg = default_value;
if $a {
dmg = $a;
} else {
dmg = 0;
}
*** do lots of stuff here with dmg ***or even: dmg = 0;
if $a {
dmg = $a;
}
*** do lots of stuff here with dmg ***For this particular point, we might also want to add a dedicated syntax? Something like dmg = $a ? 0;
// more complex
dmg = $a * $b ? 0;
// dmg = $a * $b if $a AND $b are defined, 0 if notBeside, is it easy to deal with scope variable within Lycan? |
|
I completely agree with @Ikyushii here, and I think that default deserve a custom syntax. Coming back to if $effect_a {
dmg = 23;
$hp -= dmg;
}
if $effect_b {
factor = 2;
$hp += dmg / 2; // Oops, dmg was not defined !
}This program could be well-formed as long as I would say that as we can still try first in the editor to see how does it feels to have scopes. |
|
OK so if I understand correctly, you want the scope to just restrict the variable creation. Does it really make sense in our particular case, as we don't have variable declaration and every instruction is an assignment? |
It would be true if there were a default value for each type variable and for any variable name, you would be able to use it whenever you want, even before first assignment. |
|
Okay I just want to make a recap, to concise the discussion: So far several problems encountered:
What do you think, what do you think make more sense and is easier to understand? |
|
I'm confused. What's the a = 23;
b = 10;
if $b {
a = 42 + $b;
c = 12;
}I think the proposals 2 and 3 are are readable and “computable by head” without headache, on the contrary proposal 1 is a very bad idea, not intuitive at all.. I think we should go for proposal 2. |
|
From an implementation point of view, what is far easier is:
With this I think we can cover all the use cases, it is probably the easiest to understand, and makes the implementation much easier for a language that we don't expect to use very often. If later we think we need to change that, we can probably port the few (probably 3) scripts written in this language to whatever new syntax we want, but at the moment I'd rather keep things simple and not spend to much time on this. |
|
|
|
@Nemikolh: it's clearer that way. @Vaelden: I'm not sure to follow you, but it's because I didn't look at your implementation. So, correct me if I'm wrong. My proposal with the dmg = 0;
if $a {
if $b {
dmg = $a * $b;
}
}It will have exactly the same result as my This syntax only concerns global variable. Hence, something like that will fail if dmg = a * $b ? 0This being said, I don't think this syntactic sugar is neither really needed nor critical. If you prefer using proposal 3 (because it's how the things are done right now) it's fine for me. But how do you want to deal with something like that: a = 23;
b = 10;
if $global {
a = 42 + b; // a will be 52 for this scope only
c = 12;
}
d = c;
|
|
I personally think that implementations problems should be discussed elsewhere. dmg = 0;
if $a {
if $b {
dmg = $a;
}
}is more readable than: dmg = $a * $b ? 0;? Besides, I don't see dealing with dmg = $a * $b ? $c;would be ill-formed if
It's not about use cases but about readability and script semantics. Again I don't think you should mention implementation as an argument, we're not doing implementation driven RSP as far as I know.
This is exactly the point of the discussion: Keep things simple and understandable that express user intuition. In the end, once we agreed on this, It won't take much time to implement in the editor and to start to play with it. So assuming, we need to refine or go backward we can easily do so. If the rust implementation is boring you, you can eventually work on something else, the time we stabilize the scripting language. |
|
x) Writing at the same time and giving the same example, that is funny! After having seen the last example from @Ikyushii, I'm definitely convinced that proposal 2, is the more easy to use and will lead to script that can't fail at run-time. So I equally vote for proposal 2. |
|
I can help with static analysis of our scripts, in order to answer the question “is this script ill-formed?”. For instance, the static analysis might help to determine if:
(I had some course about static analysis during my master degree) |
|
I think we should split this RSP into two:
It should be much more clearer! |
|
I'm okay with that. |
|
If everyone agree, I will make the split and propose some updates tonight. @Nemikolh, if you could wait before doing your own changes, it would be perfect. |
This RFC proposes a specification for a specific domain language to describe game desin rules. It will permits to change those rules within Renaissance without having to neither knowing Rust nor recompiling Lycan.