gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
277 stars 61 forks source link

GDL don't detect multiple uses of the same keyword when calling pro or function #1823

Open alaingdl opened 6 months ago

alaingdl commented 6 months ago

code :

$ more toto.pro

pro toto1, key1=key1;, key1=key1
print, 'toto1'
end
function toto2, key2=key2;, key2=key2
print, 'toto2'
return, 1
end

pro toto
toto1, key1='aze', key1='rty'
print, toto2(key2='aze', key2='rty')
end

Running GDL :

GDL> .r toto
% Compiled module: TOTO1.
% Compiled module: TOTO2.
% Compiled module: TOTO.
GDL> TOTO
toto1
toto2
       1

Running IDL :

IDL> .r toto
% Compiled module: TOTO1.
% Compiled module: TOTO2.
% Compiled module: TOTO.
IDL> toto
% Duplicate keyword KEY1 in call to: TOTO1
% Execution halted at: TOTO               13 /home/alaingdl/toto.pro
%                      $MAIN$          
IDL> .skip 1
% Skipped to: TOTO               15 /home/alaingdl/toto.pro
IDL> .con
% Duplicate keyword KEY2 in call to: TOTO2
% Execution halted at: TOTO               15  /home/alaingdl/toto.pro
%                      $MAIN$          

But the detection of repeated keyword is (more or less) OK ! (same code, removing the ";")


IDL> .r toto
pro toto1, key1=key1, key1=key1
                               ^
% KEY1 is already defined with a conflicting definition.

GDL> .r toto.pro
% Ambiguous keyword: KEY1
GillesDuvert commented 6 months ago

yes, known feature. Is it really bothering?