Opened 10 years ago

Closed 10 years ago

#450 closed proposed feature (fixed)

Extension: blackbox types 'reference' and 'shared'

Reported by: dreyer Owned by: dreyer
Priority: minor Milestone: 3-1-5 and higher
Component: dontKnow Version: 3-1-5
Keywords: Cc:


In this pull request at you'll find a bunch of patches, introducing new blackbox-based data types reference and shared. reference uses a reference counted wrapper to adds multiple handles for a given identifier, each of which can be copied, stored and handed over without actually copying the represented Singular data. shared uses a similar approach, but is not tied to an existing identifier.

As long as this features is experimental, shared and reference are hidden by default. Please use system("reference"); or system("shared"); to activate them.

> system("reference");
> system("shared");
> int i = 0;
> reference ref = i;
> shared sh = 12;
> ref + sh;    // automated 'dereferencing'
> ref + 4;
> list ll = list(ref, ref, ref, ref, ref, ref, ref);
> string(ll);
> ref = 1;
> string(ll);   // all one now
> list changeme;       // proc may have side-effects now!
> changeme;
empty list
> proc setfirst(reference ll, def arg) {  ll[1] = arg; }
> setfirst(changeme, 17);
> changeme[1];

The patches also contains an extensive test file countedref_s.tst and the documentation chapter countedref.doc, so everysthing is in the pull request, no work has to be done, but th decision has to be made. The "spielwiese" variant exists and tests well on TeamCity.

Change History (4)

comment:1 Changed 10 years ago by Oleksandr

IMHO, you actually did what i asked for loooooong time ago:

Thanks, great job!

comment:2 in reply to:  1 Changed 10 years ago by dreyer

Replying to motsak:

IMHO, you actually did what i asked for loooooong time ago:

Thanks, great job!

Nice to hear! Your example was useful, reading of attributes was not properly handled yet. This comes with the following pull request:

Last edited 10 years ago by dreyer (previous) (diff)

comment:3 Changed 10 years ago by mlee

Owner: changed from somebody to dreyer

comment:4 Changed 10 years ago by dreyer

Resolution: fixed
Status: newclosed

Meanwhile, this was merged.

Note: See TracTickets for help on using tickets.