Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Feature request, LET variable.* = value OR INITIALIZE variable.* TO value  (Read 8755 times)
David H.
Posts: 158


« on: April 18, 2008, 04:00:38 pm »

I was a bit surprised when I coded:-

        LET my_rec.* = 0

(for a record containing DECIMALS & INTEGERS only) and it failed with a compile error. I just assumed the compiler would allow this syntax and leave it up to the programmer to do the correct thing i.e. not set a DECIMAL to a STRING for instance.

You have the same thing with INITIALIZE my_rec.* TO value, where the compiler reports NULL expected instead of 'value'.  It would be nice to be able to code:-

       LET my_rec.* = value    or
       INITIALIZE my_rec.* TO value

as this is a useful code saving.

David
Sebastien F.
Four Js
Posts: 509


« Reply #1 on: April 21, 2008, 09:30:32 am »

Hello David,

I believe that records defined only with numeric members is not a common usage, so I don't think LET rec.* = value or INITIALIZE rec.* TO value would be a real added value to Genero...

I do also believe it's seldom to initialize all members of a record with the same value, except NULL of course, which is by the way not a "value", but rather a "non-value"...

Best regards,
Seb
David H.
Posts: 158


« Reply #2 on: April 21, 2008, 05:02:04 pm »

Hi Seb,

I was just using a number as an example, I don't see why any value could not be used. INITIALIZE is fairly flexible and can be used with THRU, on arrays and lists of variables, so it offers several ways currently to set multiple values to NULL via a single line of BDL code. My thinking is that TO value just offers you even more options...

I don't know about others but we tend to set all numeric values to 0 when initializing so NULL does not become an issue if or when the values are used in some calculation somewhere...

D.
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines