SC: Array and Hashtable/Hashmap/Dictionary

Features wanted...
Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

SC: Array and Hashtable/Hashmap/Dictionary

Post 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
Last edited by Filehero on 24 Sep 2016 09:23, edited 1 time in total.

highend
Posts: 13313
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by highend »

+1
One of my scripts helped you out? Please donate via Paypal

ds1508
Posts: 17
Joined: 19 Jul 2016 12:51
Location: NRW, Germany

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by ds1508 »

+1
In special cases you may contact me on Discord: http://bit.ly/dsDisco

PeterH
Posts: 2785
Joined: 21 Nov 2005 20:39
Location: Germany

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by PeterH »

You think of something like $a[$i1,$i2] or alike?

+1
Win11 Pro 223H2 Gerrman

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by Filehero »

PeterH wrote:You think of something like $a[$i1,$i2] or alike?
Yes, nothing fancy.

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post 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: ?)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 60558
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post 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...

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post 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... :)

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by Filehero »

Just integrated Don's note on switch() statement.

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

highend
Posts: 13313
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by highend »

You started this thread, edit it's title! :mrgreen:
One of my scripts helped you out? Please donate via Paypal

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post 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:

admin
Site Admin
Posts: 60558
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by admin »

I find the current title okay. It tells me something.

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post 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. :)

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by Filehero »

Any update on Arrays, Don?

FH

admin
Site Admin
Posts: 60558
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC: Array and Hashtable/Hashmap/Dictionary

Post by admin »

Not yet, I'll let you know...

Post Reply