Page 1 of 2

SC: Array and Hashtable/Hashmap/Dictionary

Posted: 24 Sep 2016 07:59
by Filehero
Hi Don,

don't know what new feature you're coming out next (besides diving deep into the forum's backlog).

But: is there any chance the SC will get support for some of these standard collection types?

Mimicking an array with a "|"-separated string is possible to a certain degree using gettoken(), and Sammay has provided his dict() implementation of such an in-memory ini-structure.

But frankly I really would prefer to have native support for these absolutely basic data types. All those "workarounds" stay, hmm, workarounds. Readability of more complex scripts is suffering heavily, and the visual elegance is lacking.

I don't know PHP (and the SC engine), so I can't estimate effort and complexity ("can of worms"). But I would be really, really happy.


Cheers,
Filehero

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 24 Sep 2016 08:07
by highend
+1

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 24 Sep 2016 10:20
by ds1508
+1

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 24 Sep 2016 12:36
by PeterH
You think of something like $a[$i1,$i2] or alike?

+1

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 24 Sep 2016 13:48
by Filehero
PeterH wrote:You think of something like $a[$i1,$i2] or alike?
Yes, nothing fancy.

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 24 Sep 2016 17:53
by bdeshi
:tup:
My two paise:

A handful of new builtin functions maybe more unambiguous than the usual bracket notation. XY still allows unquoted strings, so $arr[$i] can be interpreted as an interpolated string, or pattern.

Code: Select all

$a = $b[$i]; // can be interpreted as $a = $b . '[' . $i . ']';
$a = [];     // is $a an empty array or the string '[]' ?
Of course, no qualms if Don stops accepting unquoted strings in favor of [arrays] syntax. (But then what about "string $a string $a[$i]" :whistle: ?)

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 02 Oct 2016 13:22
by admin
I have a big list of fascinating things to come, and real arrays are one of them.

But, yes, first I have to dig through some layers of unanswered forum posts...

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 02 Oct 2016 20:47
by Filehero
admin wrote:I have a big list of fascinating things to come, and real arrays are one of them.
:shock: :shock: :shock: :tup: :tup: :tup: :tup:

More SC teasers possible? :?:

Yeah, I guess there are some rewrites ahead for me... :)

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 02 Nov 2016 08:58
by Filehero
Just integrated Don's note on switch() statement.

Maybe someone could change the thread titel to something more script generic.

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 02 Nov 2016 09:21
by highend
You started this thread, edit it's title! :mrgreen:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 02 Nov 2016 10:02
by Filehero
highend wrote:You started this thread, edit it's title! :mrgreen:
Sigh, stupid me.

Don, do you mind calling it Scripting 3.0? :whistle:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 02 Nov 2016 11:07
by admin
I find the current title okay. It tells me something.

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 02 Nov 2016 18:30
by Filehero
If Dictionaries/Associative Arrays should become implemented, I would expect them to be "permanentable".

Actually this is mere rhetorical, since you never would accept such an exception because it destroys any elegance and balance. I'm rather asking because it could save me some boiler-plate ini-file related code in the future. :)

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 24 Jun 2017 08:35
by Filehero
Any update on Arrays, Don?

FH

Re: SC: Array and Hashtable/Hashmap/Dictionary

Posted: 28 Jun 2017 11:55
by admin
Not yet, I'll let you know...