View Full Version : Minor parameter/syntax error bug(?), more curiosity than anything else...
wonkey_monkey
2nd August 2013, 18:00
With Avisynth 2.6, the following works:
blankclip(width=4,height=4,fps=25,length=100000,channels=2)
Note the "channels" parameter. If I change it to this:
blankclip(width=4,height=4,fps=25,length=100000,channels=2,foobar=100)
I get told that
blankclip does not have a named argument "channels"
If I swap the last two parameters around, I get the expected error, that foobar is not a named argument of blankclip. Why does this happen?
David
foxyshadis
2nd August 2013, 22:56
Avisynth with try to match your argument list up against every version of a function, and if none match, hands it off to the first version to do the complaining; it doesn't try to figure out which version is closest to what you wanted. Since AviSynth has both the old version with "stereo" and the new with "channels", and "stereo" comes first, channels looks like an invalid argument. foobar is an invalid argument to both, of course, so it makes no difference which gets matched.
IanB
3rd August 2013, 00:53
Damn! snap foxyshadis :D
It's a short coming in the parser with function aliases.
BlankClip has two aliases, the first with 2 boolean args, "stereo" and "sixteen_bit", and the second with int "channels" and string "sample_type".
The parser first tries to determine the correct alias with a match of function name, "BlankClip", and a pre-match of the named arguments but without any argument type checking.
All the aliases fail, so it then does a full parse, with error reporting, using the default first alias. During the full parse the match fail with "channels" not being a named argument in the default first aliases list.
{ "BlankClip", "[]c*[length]i[width]i[height]i[pixel_type]s[fps]f[fps_denominator]i[audio_rate]i[stereo]b[sixteen_bit]b[color]i[color_yuv]i[clip]c", Create_BlankClip },
{ "BlankClip", "[]c*[length]i[width]i[height]i[pixel_type]s[fps]f[fps_denominator]i[audio_rate]i[channels]i[sample_type]s[color]i[color_yuv]i[clip]c", Create_BlankClip },
wonkey_monkey
4th August 2013, 12:55
Thanks for the replies, I am now suitably informed!
Wilbert
4th August 2013, 18:54
It's a short coming in the parser with function aliases.
Is it fixable?
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.