x <= y
x, y = y, <nil>
x :<= s[len(s) - 1]s = s[:len(s) - 1]return x
--
It actually acts like what you said.And I found this in the specification which was missed by me before:for slices, the upper bound is the capacity rather than the length.Thanks your for pointing out my mistake.
"non-starter" ?
-j
--
That may be, but making them part of the language builtin operators would be insanely annoying.
--
--
t <= s[10:len(s)]
move(x, y)move(t, s[10:len(s))
<< isn't used in Go yet? http://play.golang.org/p/mmJ_rI-o9O
I can't think of a language, even a math-heavy one described in >50% greek that actually uses non-ascii characters in its main syntax.
--
Wolfram Mathematica.End-users normally interact with via notebook interface, and it handles math input really well.--
I expect #2 is not done because caps cannot currently be shrunk without unsafe or other out-of-spec means, yet a shrinking cap can be simulated with strings, and both slices and heads can shrink the used head of the backing array. Certainly most cases of head/tail shrinking would not produce large enough, aligned regions that could be reused or otherwise reclaimed, unless you're dealing with big data, yet the GC could defer scanning backing arrays for pointers until all non-array regions have been marked, ignoring any pointers in unused portions of each array.
Though hardly groundbreaking, I figure compile time information for a precise GC could put an allocated array into 3 categories which could further increase the efficiency of the collection phase: non-ptr, ptr, and potentially self-referential ptr.
Certainly slides would not know about other slices, but since the GC is mark and sweep, presumably it would detect all slice headers pointing to a backing array.
The question becomes: 1) does the current GC only find/inspect the pointer in the slice and compare it to some allocator metadata about the backing array, 2) or does it/could it easily inspect the slice cap to determine the part of the backing array used by all slices (which would be a max function across discovered caps)?
I expect #2 is not done because caps cannot currently be shrunk without unsafe or other out-of-spec means, yet a shrinking cap can be simulated with strings, and both slices and heads can shrink the used head of the backing array. Certainly most cases of head/tail shrinking would not produce large enough, aligned regions that could be reused or otherwise reclaimed, unless you're dealing with big data, yet the GC could defer scanning backing arrays for pointers until all non-array regions have been marked, ignoring any pointers in unused portions of each array.
Though hardly groundbreaking, I figure compile time information for a precise GC could put an allocated array into 3 categories which could further increase the efficiency of the collection phase: non-ptr, ptr, and potentially self-referential ptr.
--
If you consider the backing array a single, indivisible object, then I suppose so. I would have expected the book keeping for the original allocation to be modifiable.
On Thursday, January 10, 2013 1:13:23 PM UTC-7, kortschak wrote:Surely this involves a partial free of an object. How do you do this?
On 11/01/2013, at 6:31 AM, "Kevin Gillette" <extempor...@gmail.com> wrote:
> Of course -- I'm referring to shrinking the capacity of a slice (thus you could not slice past the current cap into what used to be the cap).
--
Surely this involves a partial free of an object. How do you do this?
If there's any concern about no longer being able to tell if two slices share the same backing array, it's semantically moot in almost every way, in that two non-overlapping slices have the same relative properties whether they share an array or not. It could matter if you need very tight memory control, but just as it is now, it would be trivial to do your own book keeping to make such determinations.