<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: invalid non-declared variable in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130405#M26420</link>
    <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Yes, non-declared variables will keep working. They are always considered as numeric variables with the value of zero.&lt;BR /&gt;
&lt;BR /&gt;
And yes, we should have better error messages. I don't think we can change them all in one big chunk but we'll try to go in the proposed clearer direction with new messages and when touching old ones.&lt;BR /&gt;
&lt;BR /&gt;
About AC13 and GDL... I'm really happy about the fixes and changes we make but I'm afraid only one of the fundamental problems will be solved. I will post a summary about the little and bigger changes when we enter alpha phase. Feel free to remind me in case I appear to forget about that.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Zsolt</description>
    <pubDate>Wed, 10 Dec 2008 07:34:00 GMT</pubDate>
    <dc:creator>ztaskai</dc:creator>
    <dc:date>2008-12-10T07:34:00Z</dc:date>
    <item>
      <title>invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130393#M26408</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;can you reproduce/explain this behavior? &lt;BR /&gt;
 &lt;BR /&gt;
In a master script: &lt;BR /&gt;
 &lt;BR /&gt;
&lt;B&gt;DEFINE TRANSLUCENT_FILL "test1" zero,2,3,4,5,6,7,8, 0.25 &lt;BR /&gt;
zero=0 &lt;BR /&gt;
DEFINE TRANSLUCENT_FILL "test2" zero,2,3,4,5,6,7,8, 0.25&lt;/B&gt; &lt;BR /&gt;
 &lt;BR /&gt;
when checking these instructions, ArchiCAD reports "insufficient parameters" for the first DEFINE, where a non-declared variable is used. &lt;BR /&gt;
Thes second one is copy-pasted, to avoid any possible difference, but the zero is declared, and it works.&lt;BR /&gt;
&lt;BR /&gt;
--Roberto Corona--&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 02 Dec 2008 11:48:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130393#M26408</guid>
      <dc:creator>rocorona</dc:creator>
      <dc:date>2008-12-02T11:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130394#M26409</link>
      <description>Roberto:&lt;BR /&gt;
&lt;BR /&gt;
My guess is that the first (undeclared) "zero" is read as a string expression (text) where ArchiCAD expects a numeric expression (number). Defining "zero" as a number corrects this error.&lt;BR /&gt;
&lt;BR /&gt;
David</description>
      <pubDate>Tue, 02 Dec 2008 12:50:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130394#M26409</guid>
      <dc:creator>David Maudlin</dc:creator>
      <dc:date>2008-12-02T12:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130395#M26410</link>
      <description>this could be true, but we know that undeclared variables are initialized as numbers.  &lt;BR /&gt;
And, in fact, if I test it (at the script first line) with VARTYPE (zero) it says is "1" (number) not "2" (string). &lt;BR /&gt;
 &lt;BR /&gt;
Just discovered that an explicit use of "zero" as number (before the first DEFINE command) seems to "force" a declaration.  &lt;BR /&gt;
For examples, using a simple  &lt;BR /&gt;
 &lt;BR /&gt;
&lt;B&gt;x=zero+zero &lt;/B&gt;  &lt;BR /&gt;
 &lt;BR /&gt;
the error message disappears.</description>
      <pubDate>Tue, 02 Dec 2008 14:16:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130395#M26410</guid>
      <dc:creator>rocorona</dc:creator>
      <dc:date>2008-12-02T14:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130396#M26411</link>
      <description>&lt;BLOCKQUOTE&gt;rocorona wrote:&lt;BR /&gt;this could be true, but we know that undeclared variables are initialized as numbers.  &lt;BR /&gt;
And, in fact, if I test it (at the script first line) with VARTYPE (zero) it says is "1" (number) not "2" (string). &lt;BR /&gt;
 &lt;BR /&gt;
Just discovered that an explicit use of "zero" as number (before the first DEFINE command) seems to "force" a declaration.  &lt;BR /&gt;
For examples, using a simple  &lt;BR /&gt;
 &lt;BR /&gt;
&lt;B&gt;x=zero+zero &lt;/B&gt;  &lt;BR /&gt;
 &lt;BR /&gt;
the error message disappears.&lt;/BLOCKQUOTE&gt;

Roberto, &lt;BR /&gt;
&lt;BR /&gt;
I would have answered the same as David, pat1 to pat8 are integers. Is there something else to understand?&lt;BR /&gt;
But your second post makes more sense.&lt;BR /&gt;
&lt;BR /&gt;
Yes, I get the same result/alerts.&lt;BR /&gt;
May be zero is a reserved keyword for GS programmers. Anyway, thanks for the info.</description>
      <pubDate>Tue, 02 Dec 2008 15:57:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130396#M26411</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-12-02T15:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130397#M26412</link>
      <description>There are a number of ways to initialize the variable.&lt;BR /&gt;
1. Add a new parameter to the part with the Variable "zero".&lt;BR /&gt;
2. At the beginning of the Master Script add "zero=zero".&lt;BR /&gt;
3. At the beginning of the Master Script add "Print zero".&lt;BR /&gt;
&lt;BR /&gt;
I am sure there are more, for what it is worth.&lt;BR /&gt;
&lt;BR /&gt;
David</description>
      <pubDate>Wed, 03 Dec 2008 13:49:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130397#M26412</guid>
      <dc:creator>David Maudlin</dc:creator>
      <dc:date>2008-12-03T13:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130398#M26413</link>
      <description>When using numeric variables, you should initialize them before their value is used for the first time. The good way to do this is the following for a variable which is OK to start from a given constant:&lt;BR /&gt;

&lt;PRE&gt;isOkToStartFomZero = 0
shouldStartFrom3 = 3
&lt;/PRE&gt;

AC13 will have a GDL warning to warn developers about uninitialized variables. It helps you stay in picture about what is happening.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Zsolt</description>
      <pubDate>Wed, 03 Dec 2008 15:24:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130398#M26413</guid>
      <dc:creator>ztaskai</dc:creator>
      <dc:date>2008-12-03T15:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130399#M26414</link>
      <description>I checked, zero is not a reserved keyword. &lt;BR /&gt;
x = zero+zero is the same as writing zero = 0&lt;BR /&gt;
zero can be replaced by any variable. &lt;BR /&gt;

&lt;BLOCKQUOTE&gt;ztaskai wrote:&lt;BR /&gt;When using numeric variables, you should initialize them before their value is used for the first time. The good way to do this is the following for a variable which is OK to start from a given constant:&lt;BR /&gt;

&lt;PRE&gt;isOkToStartFomZero = 0
shouldStartFrom3 = 3
&lt;/PRE&gt;

AC13 will have a GDL warning to warn developers about uninitialized variables. It helps you stay in picture about what is happening.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Zsolt&lt;/BLOCKQUOTE&gt;

Good point.</description>
      <pubDate>Wed, 03 Dec 2008 15:39:45 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130399#M26414</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-12-03T15:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130400#M26415</link>
      <description>Hi Zsolt,
&lt;BLOCKQUOTE&gt;ztaskai wrote:&lt;BR /&gt;AC13 will have a GDL warning to warn developers about uninitialized variables. It helps you stay in picture about what is happening.&lt;/BLOCKQUOTE&gt;
Just to tease us a little... In a scale of -10 to 10 which do you think will be our impression about AC13 GDL new features?...  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_wink.gif" style="display : inline;" /&gt;&lt;BR /&gt;
Thank you for the news!</description>
      <pubDate>Wed, 03 Dec 2008 17:47:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130400#M26415</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-12-03T17:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130401#M26416</link>
      <description>&lt;BLOCKQUOTE&gt;ztaskai wrote:&lt;BR /&gt;AC13 will have a GDL warning to warn developers about uninitialized variables.&lt;/BLOCKQUOTE&gt;

That's great news, Zsolt.&lt;BR /&gt;
&lt;BR /&gt;
The old behavior of an uninitialized variable being treated as a zero-value has 'bitten' too many newcomers to GDL, and even old timers.  A simple typo results in a variable with a zero value which can take considerable time to track down and debug.  The warning will be a great help to everyone.&lt;BR /&gt;
&lt;BR /&gt;
Certainly, some old (user written) library parts will need to have initialization statements added, but that is for the good IMHO.  It was lazy programming to intentionally assume an uninitialized variable would be zero.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Karl</description>
      <pubDate>Wed, 03 Dec 2008 18:06:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130401#M26416</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2008-12-03T18:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130402#M26417</link>
      <description>&lt;BLOCKQUOTE&gt;ztaskai wrote:&lt;BR /&gt;AC13 will have a GDL warning to warn developers about uninitialized variables.&lt;/BLOCKQUOTE&gt;

What would also be good is to extend this behavior to all error cases in GDL, not just uninitialized variable. I could even imagine ArchiCAD giving an advice in the error message on how to fix it.&lt;BR /&gt;
For example, when the "Fill not found at line xxx" message, the message could also say that this and this parameter or line of code calls for a fill with this fill index, but it does not exist, check in your Fill Types Dialog or the Attribute Manager or whatever blablabla.&lt;BR /&gt;
The point would be to enable people to solve the problem themselves.</description>
      <pubDate>Thu, 04 Dec 2008 11:04:56 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130402#M26417</guid>
      <dc:creator>Laszlo Nagy</dc:creator>
      <dc:date>2008-12-04T11:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130403#M26418</link>
      <description>Hi Laszlo,&lt;BR /&gt;
&lt;BR /&gt;
The lack of detail in a error message is directed linked to the enthusiasm for a software...&lt;BR /&gt;
I mean... a new user who reads the actual AC error messages looses a considerable portion of enthusiasm as it doesn't point to a detail solution for the error.&lt;BR /&gt;
Huge impact and very simple to implement...&lt;BR /&gt;
Good idea Laszlo!...</description>
      <pubDate>Thu, 04 Dec 2008 11:23:11 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130403#M26418</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-12-04T11:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130404#M26419</link>
      <description>&lt;BLOCKQUOTE&gt;ztaskai wrote:&lt;BR /&gt;When using numeric variables, you should initialize them before their value is used for the first time.  &lt;BR /&gt;
[...] &lt;BR /&gt;
Zsolt&lt;/BLOCKQUOTE&gt; &lt;BR /&gt;
 &lt;BR /&gt;
As an old BASIC programmer, I absolutely agree that declared variables are "safer" and a good programming practice. &lt;BR /&gt;
I only noticed that strangeness when copying-pasting the syntax from the GDL manual for a quick test. &lt;BR /&gt;
The worst, as pointed out by others, is the cryptic error message ("insufficient parameters"). &lt;BR /&gt;
 &lt;BR /&gt;
Anyway, the same use of an undeclared variable, works without problems in "old" Define Fill. &lt;BR /&gt;
 &lt;BR /&gt;
&lt;B&gt;DEFINE FILL "testfill" undeclared, 2, 3, 4, 5, 6, 7, 8, &lt;BR /&gt;
1, 0.0, 2, &lt;BR /&gt;
0.1, 0.0, 0.0, 0.0, 0, &lt;BR /&gt;
0.1, 90.0, 0.0, 0.0, 0, &lt;BR /&gt;
1.0, 1.0 &lt;/B&gt;</description>
      <pubDate>Tue, 09 Dec 2008 11:02:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130404#M26419</guid>
      <dc:creator>rocorona</dc:creator>
      <dc:date>2008-12-09T11:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130405#M26420</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Yes, non-declared variables will keep working. They are always considered as numeric variables with the value of zero.&lt;BR /&gt;
&lt;BR /&gt;
And yes, we should have better error messages. I don't think we can change them all in one big chunk but we'll try to go in the proposed clearer direction with new messages and when touching old ones.&lt;BR /&gt;
&lt;BR /&gt;
About AC13 and GDL... I'm really happy about the fixes and changes we make but I'm afraid only one of the fundamental problems will be solved. I will post a summary about the little and bigger changes when we enter alpha phase. Feel free to remind me in case I appear to forget about that.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Zsolt</description>
      <pubDate>Wed, 10 Dec 2008 07:34:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130405#M26420</guid>
      <dc:creator>ztaskai</dc:creator>
      <dc:date>2008-12-10T07:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: invalid non-declared variable</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130406#M26421</link>
      <description>Thank you very much for your feedback Zsolt. &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;
&lt;BLOCKQUOTE&gt;ztaskai wrote:&lt;BR /&gt;I will post a summary about the little and bigger changes when we enter alpha phase.&lt;/BLOCKQUOTE&gt;
I'm looking foward!</description>
      <pubDate>Wed, 10 Dec 2008 09:49:55 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/invalid-non-declared-variable/m-p/130406#M26421</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-12-10T09:49:55Z</dc:date>
    </item>
  </channel>
</rss>

