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:

Description

In this pull request at https://github.com/Singular/Sources/pull/180 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'
12
> ref + 4;
4
> list ll = list(ref, ref, ref, ref, ref, ref, ref);
> string(ll);
0,0,0,0,0,0,0
> ref = 1;
> string(ll);   // all one now
1,1,1,1,1,1,1
> 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];
17

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: http://www.singular.uni-kl.de:8002/trac/ticket/95

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: http://www.singular.uni-kl.de:8002/trac/ticket/95

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: https://github.com/Singular/Sources/pull/185

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.