Page 1 of 1
Should compile?
Posted: Mon Apr 15, 2019 9:01 am
by rrTea
It seems strange that Variable1.T compiles, I'd expect only R/G/B/A and X/Y/Z are allowed.
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
<OnLoaded>
<ZExpression>
<Expression>
<![CDATA[Variable1.X = 1;
trace ("It doesn't exist but " + intToStr(Variable1.T) );]]>
</Expression>
</ZExpression>
</OnLoaded>
<Content>
<Variable Name="Variable1" Type="6"/>
</Content>
</ZApplication>
Re: Should compile?
Posted: Mon Apr 15, 2019 12:44 pm
by Ats
That's interesting. I would expect only X and Y in your example since it's a vec2...
But almost all the letters are working, the commented ones are not:
Code: Select all
//trace ("A " + intToStr(Variable1.A) );
//trace ("B " + intToStr(Variable1.B) );
trace ("C " + intToStr(Variable1.C) );
trace ("D " + intToStr(Variable1.D) );
trace ("E " + intToStr(Variable1.E) );
trace ("F " + intToStr(Variable1.F) );
trace ("G " + intToStr(Variable1.G) );
trace ("H " + intToStr(Variable1.H) );
trace ("I " + intToStr(Variable1.I) );
trace ("J " + intToStr(Variable1.J) );
trace ("K " + intToStr(Variable1.K) );
trace ("L " + intToStr(Variable1.L) );
trace ("M " + intToStr(Variable1.M) );
trace ("N " + intToStr(Variable1.N) );
trace ("O " + intToStr(Variable1.O) );
trace ("P " + intToStr(Variable1.P) );
trace ("Q " + intToStr(Variable1.Q) );
trace ("R " + intToStr(Variable1.R) );
trace ("S " + intToStr(Variable1.S) );
trace ("T " + intToStr(Variable1.T) );
trace ("U " + intToStr(Variable1.U) );
trace ("V " + intToStr(Variable1.V) );
//trace ("W " + intToStr(Variable1.W) );
trace ("X " + intToStr(Variable1.X) );
trace ("Y " + intToStr(Variable1.Y) );
//trace ("Z " + intToStr(Variable1.Z) );
Re: Should compile?
Posted: Tue Apr 23, 2019 10:09 am
by VilleK
Indeed this should not compile

. I will stop it from working so please don't write code that relies on it working.
Re: Should compile?
Posted: Thu Apr 02, 2020 3:04 am
by rrTea
Ville: Of course I wasn't really relying on such code

, I just discovered it by mistake during editing.
And as for the next one, I already posted about this elsewhere, but was never able to isolate what exactly is breaking it. Well I finally managed to boil it down to the simplest possible test case! I present you… The ultimate "Shouldn't compile" example!
Paste this into an empty ZExpression and hit Alt+Enter:
Re: Should compile?
Posted: Thu Apr 02, 2020 8:32 am
by VilleK

.
Yep, another problem.
It is the old bug that extra "}" at the end is not parsed as an error. You can have too many of them in a ZLibrary too and the compiler does not protest.
I haven't found a fix for this that seems worth the trade-off "how likely is this change to possibly break some code by introducing some unforeseen edge-case, compared to how serious is this bug". So it will still be here for now.
Re: Should compile?
Posted: Thu Apr 02, 2020 11:26 am
by rrTea
No worries – it can get confusing but at least it's not breaking anything.