disable keyword "short forms" [message #89756] |
Mon, 01 December 2014 04:27  |
markb77
Messages: 217 Registered: July 2006
|
Senior Member |
|
|
hi,
Is there a compiler option that I can use to turn off the "feature" that allows you to specify a keyword using only the first few characters of the keyword name?
This is an AWFUL feature of IDL.. especially when it comes to object programming.
I have an object, MYOBJ, that inherits IDLgrModel, for example. Now, one of the properties of MYOBJ is "Hidetext". This compiles and runs with no errors.. however, this is a serious bug. When you try to set the HIDE property of MYOBJ, it doesn't work, because IDL thinks you are trying to set "Hidetext" instead.
This "short form keywords" feature is, therefore, a surefire way to generate bugs. Fix please?
thanks
Mark
|
|
|
Re: disable keyword "short forms" [message #89758 is a reply to message #89756] |
Mon, 01 December 2014 11:49   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Monday, December 1, 2014 5:27:22 AM UTC-7, superchromix wrote:
> hi,
>
> Is there a compiler option that I can use to turn off the "feature" that allows you to specify a keyword using only the first few characters of the keyword name?
>
> This is an AWFUL feature of IDL.. especially when it comes to object programming.
>
> I have an object, MYOBJ, that inherits IDLgrModel, for example. Now, one of the properties of MYOBJ is "Hidetext". This compiles and runs with no errors.. however, this is a serious bug. When you try to set the HIDE property of MYOBJ, it doesn't work, because IDL thinks you are trying to set "Hidetext" instead.
>
> This "short form keywords" feature is, therefore, a surefire way to generate bugs. Fix please?
>
> thanks
> Mark
Hi Mark,
Well, unfortunately, that decision was made about 30 years ago, at the dawn of IDL. It's probably a holdover from the days when "real programmers" just used variables that were a single character. I can't tell you how many places in IDL's C code where I've discovered a variable "i" that actually points to some huge important C structure.
There's no way to disable this behavior, and it isn't going to change - it's too deeply embedded in the interpreter. Annoying, I know.
There are some "tricks" you can do with _REF_EXTRA to get keywords to work that start with the same characters, but I wouldn't recommend it because it will just confuse people who are actually expecting the goofy behavior.
Sorry,
Chris
ExelisVIS
|
|
|
Re: disable keyword "short forms" [message #89759 is a reply to message #89758] |
Tue, 02 December 2014 03:55  |
markb77
Messages: 217 Registered: July 2006
|
Senior Member |
|
|
On Monday, December 1, 2014 8:49:31 PM UTC+1, Chris Torrence wrote:
> On Monday, December 1, 2014 5:27:22 AM UTC-7, superchromix wrote:
>> hi,
>>
>> Is there a compiler option that I can use to turn off the "feature" that allows you to specify a keyword using only the first few characters of the keyword name?
>>
>> This is an AWFUL feature of IDL.. especially when it comes to object programming.
>>
>> I have an object, MYOBJ, that inherits IDLgrModel, for example. Now, one of the properties of MYOBJ is "Hidetext". This compiles and runs with no errors.. however, this is a serious bug. When you try to set the HIDE property of MYOBJ, it doesn't work, because IDL thinks you are trying to set "Hidetext" instead.
>>
>> This "short form keywords" feature is, therefore, a surefire way to generate bugs. Fix please?
>>
>> thanks
>> Mark
>
> Hi Mark,
>
> Well, unfortunately, that decision was made about 30 years ago, at the dawn of IDL. It's probably a holdover from the days when "real programmers" just used variables that were a single character. I can't tell you how many places in IDL's C code where I've discovered a variable "i" that actually points to some huge important C structure.
>
> There's no way to disable this behavior, and it isn't going to change - it's too deeply embedded in the interpreter. Annoying, I know.
>
> There are some "tricks" you can do with _REF_EXTRA to get keywords to work that start with the same characters, but I wouldn't recommend it because it will just confuse people who are actually expecting the goofy behavior.
>
> Sorry,
>
> Chris
> ExelisVIS
hi Chris,
Thanks for the response. Perhaps, rather than changing the way the interpreter works, something could be added which could give a warning at compilation? For example, Eclipse itself should be able to see the Get/Set-able properties of the object and its superclasses. Could Eclipse give us a warning when there are two properties starting with the same characters?
thanks
Mark
|
|
|