Extension talk:WikiScripts

It would be so nice if extension authors would put up a summary that told us something more than the title of the extension, and if they would take the time to put an actual example in place.

Keywords in and contains.
These are important and I think you should add definitions and maybe examples. Also, is there a way to remove a key/value pair from an array?

--AJim 22:10, 17 August 2011 (UTC)
 * Yes, delete( a['key'] ). I'll add that. VasilievVV 22:11, 17 August 2011 (UTC)

numeric functions
I think there have to be at least a few numeric functions defined. Perhaps floor, ceil, round, sign, abs at least. If the underlying language supports them then also log, exp, sqrt maybe max and min maybe rand and maybe even trig? Or do we just assume that if they are in js then they are here? --AJim 22:56, 17 August 2011 (UTC)
 * Coming soon. VasilievVV 15:46, 18 August 2011 (UTC)

date/time datatype and functions
I think there will be a need for date/time operations and I think it would be a mistake not to have them well-defined, paricularly in light of how much pain they have caused me in the past. --AJim 22:55, 17 August 2011 (UTC)
 * I will add datetime type when the date/time functions are added. This is not high priority issue however, so I will probably focus on that later. VasilievVV 15:46, 18 August 2011 (UTC)

short-circuit evaluation
I assume that logical evaluation (& |) short circuits, but it would be nice if the description said so. --AJim 22:59, 17 August 2011 (UTC)

escaping a for construct
Is there a way to terminate a for evaluation if the program discovers that it should not go on? --AJim 23:07, 17 August 2011 (UTC)
 * Added break/continue into documentation. VasilievVV 15:46, 18 August 2011 (UTC)

Named parameters
One thing I like about MediaWiki templates relative to real programming languages is that you can use named parameters very easily, and therefore that you don't have a fixed order of the parameters. It looks to me like it will be a pain to implement something like Cite web fully in the current version of this extension, because you really need the flexibility of named parameters. I suppose this problem could be solved by making Template:Cite web into a wrapper that calls Module:Cite web with all the parameters in the right order, but that's ugly. Ucucha 00:45, 18 August 2011 (UTC)
 * Well, as for templates, if you #invoke a function from template, the function (as well as all the other functions it calls) have access to the parser frame of the template, i.e. to all the arguments in it. See "Template library" in "Built-in functions". VasilievVV 15:46, 18 August 2011 (UTC)

some thoughts
hmm, I like the looks of this. Some thoughts (This is after only about half an hour of looking at it so some of these might be stupid thoughts or they might be already implemented and i just don't realize): Bawolff 03:06, 18 August 2011 (UTC)
 * more complex argument handling: It might be nice to have named arguments to functions, like you can do in C# (Ucucha also mentioned that above). It'd also be nice to be able to do variable number of arguments (Maybe an arguments array like in js, or some function to get an array of arguments)
 * I think the yield statement should maybe be named something else - It does something kind of different from what yield does in other languages. You wouldn't be able to make a generator that generates an infinite list with yield like you could in other langs. (although given we don't have loops other than looping over an assoc array, I guess you wouldn't be able to use yield in that fashion anyways even if it worked like in other langs).
 * Minor issue - it seems like it doesn't hook into update.php properly.


 * For first issue — can you propose alternative syntax? Same for the second issue. I will fix the third one today or tomorrow. VasilievVV 07:26, 18 August 2011 (UTC)


 * Possibly a separate keyword:


 * Invoked with:
 * Ucucha 12:24, 18 August 2011 (UTC)