All Things WinBatch > Beta

****************** WinBatch+Comiler 2018C Beta release **********************

<< < (2/3) > >>

You can use a map as the centerpiece of a tokenizer.   Each key would be a token's text and each value a token type in a parser state machine. 

Note that the same thing can be done with regular WIL arrays but for simple cases, WIL map syntax is cleaner and possibly faster.

I can think of several uses for a map right off the top of my head, such as reading a single record from a dataset and applying the field names / values as the map.  I am currently using the Scripting.Dictionary for this kind of thing - can we create maps and store them in an array? I am asking as again I use the Scripting.Dictionary for this kind of thing and I can store dictionaries in an array making for a handy way of accessing multiple records and the elements in each record by the field name.

I like the mget and mput as well - for instance I have a program that saves a student id number and the number of credit hours they currently have for match back later to see if hours changes have occurred for financial aid. I can save the id/hours in one step and read them in again later in one step.

Thanks for an excellent update!


You bring up a relevant point.  In a sense, WinBatch has always had associative arrays because of "scripting.dictionary".  That fact is one of the reasons it was not implemented natively in the WIL interpreter before now even though it has been on the to-do list for many years.  On the other hand, making associative arrays native with WIL maps permits expanding the functionality and tweaking performance, as well as, increasing availability because of simpler syntax.




--- Quote from: JTaylor on November 28, 2018, 08:42:22 pm ---So what would be a good example of a parsing related task for which it would be used?

--- End quote ---
Maybe Storing command line parameters and their arguments.

I think this is the best thing since sliced bread, or named dialog elements, which ever came first!



[0] Message Index

[#] Next page

[*] Previous page

Go to full version