Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
4th December 2014, 04:06 | #1 | Link |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
Naming parameters in script
Avisynth accepts in script calling functions with named parameters also without naming them as long as they are in correct order. This however creates problem when arrays are used. Incidentally arrays can not be named. In the following:
functionname(width = 720, height = 480, x= 90, y = 100) can also be called as functionname(720,480,90,100) if the order of parameter named correspond to that actually used in the function code. incase of "fname", "ci*[width]i[height]i[x]i[y]i) if script call is fname(1,2,3,4,720,480,x=90,y=100) it is not clear whether 720 and 480 are taken in to i+ array or assigned to width and height as was intended. This scheme is error prone. I suggest that in 2.6 it may be made compulsory to make the names of named arguments be given in script. Should it not be possible to name even array parameters such as [table]i+ ? Vapoursynth does that and appears to be good. |
4th December 2014, 18:04 | #2 | Link | |||
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,493
|
Quote:
Quote:
Quote:
I'd like to see something like the following made possible: Code:
fname([1,2,3,4], 720,480, 90,100) fname(table=[1,2,3,4], 720,480, 90,100) a=[1,2,3,4] fname(a, 720,480, 90,100) Incidentally, this is why I put my arrays at the end of my plugin parameter strings Last edited by wonkey_monkey; 4th December 2014 at 19:55. |
|||
4th December 2014, 19:00 | #3 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
I agree it's the responsibility of the plugin writer to choose a parameter list that is unambiguously interpreted. |
|
8th December 2014, 03:59 | #4 | Link |
Registered User
Join Date: Jul 2003
Location: India
Posts: 890
|
in the instance the parameter list is
c.*[ll]b[ss]s[ii]i all parameters can be read as part of the .* Possibly if the param list is c.*bsi one can get correctly. In such cases if the parameters are named for convenience, the plugin writer checking for Defined() and ensuring it is, may be way out. |
8th December 2014, 04:42 | #5 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
There is some advantage to putting array of type early in list of args, and forcing user to use the 'optional' argument name (for args following array, name no longer optional), it allows you to extend number of function arguments without breaking existing scripts.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 8th December 2014 at 17:50. |
Thread Tools | Search this Thread |
Display Modes | |
|
|