On 02/12/2010 14:18, Bruno Medeiros wrote:
On 20/11/2010 08:07, Andrei Alexandrescu wrote:
TDPL has an example that can be reduced as follows:
void main() {
uint[string] map;
foreach (line; stdin.byLine()) {
++map[line];
}
}
byLine reuses its buffer so it exposes it as char[]. Therefore,
attem
On 20/11/2010 08:07, Andrei Alexandrescu wrote:
TDPL has an example that can be reduced as follows:
void main() {
uint[string] map;
foreach (line; stdin.byLine()) {
++map[line];
}
}
byLine reuses its buffer so it exposes it as char[]. Therefore,
attempting to use map[line] will fail. The progra
I was thinking about this, and revised my idea.
While I think that in general hiding idup is a bad practice, I think
that for AA one could make the case that it might be acceptable.
idup is needed only when assigning a value using a key that isn't
immutable.
Now I think that this use in AA is
On 2010-11-20 18:04:29 -0500, "Tyro[a.c.edwards]" said:
On 11/20/2010 9:39 PM, Michel Fortin wrote:
But didn't you agree with me yesterday in another thread that it's best
to make the caller responsible for the idup in cases where you need a
string to be immutable? Now you want the reverse for
On 11/21/2010 10:39 AM, Tomek Sowiński wrote:
Dnia 21-11-2010 o 02:02:35 Tyro[a.c.edwards] napisał(a):
The harm is confusion. Now = on arrays always means aliasing, but with
your proposal, it may *sometimes* mean dupping. Imagine real-life code
with type aliasing and type inference in play, an
Dnia 21-11-2010 o 02:02:35 Tyro[a.c.edwards] napisał(a):
The harm is confusion. Now = on arrays always means aliasing, but with
your proposal, it may *sometimes* mean dupping. Imagine real-life code
with type aliasing and type inference in play, and trying to determine
whether some line makes a
On 11/21/2010 9:23 AM, Tomek Sowiński wrote:
Tyro[a.c.edwards] napisał(a):
What would be the harm if upon seeing your code the compiler did this:
char[] chars = "abc".dup;
char[] backdoor = chars;
string s = chars.idup;
assert (s == "abc");
backdoor.front = 'k'; // [1]
assert (s == "abc");
Sli
Tyro[a.c.edwards] napisał(a):
What would be the harm if upon seeing your code the compiler did this:
char[] chars = "abc".dup;
char[] backdoor = chars;
string s = chars.idup;
assert (s == "abc");
backdoor.front = 'k'; // [1]
assert (s == "abc");
Slightly magical but works according to expec
On 11/20/2010 9:39 PM, Michel Fortin wrote:
On 2010-11-20 03:07:57 -0500, Andrei Alexandrescu
said:
TDPL has an example that can be reduced as follows:
void main() {
uint[string] map;
foreach (line; stdin.byLine()) {
++map[line];
}
}
byLine reuses its buffer so it exposes it as char[]. There
On 11/20/2010 11:22 PM, Tomek Sowiński wrote:
Dnia 20-11-2010 o 13:33:29 spir napisał(a):
I find this proposal really necessary. But aren't there two issues here?
* Comparison (for lookup) by value equality should not care about
qualifiers (ie compare raw content, here plain array memory areas
On Sat, 20 Nov 2010 21:21:58 +0100
Tomek Sowiński wrote:
> Dnia 20-11-2010 o 17:09:00 spir napisał(a):
>
> >> It's busting the whole const system to smithereens.
> >>
> >> char[] chars = "abc";
> >> char[] backdoor = chars;
> >> string s = chars;
> >> assert (s == "abc");
> >> backdoor.front =
Dnia 20-11-2010 o 17:09:00 spir napisał(a):
It's busting the whole const system to smithereens.
char[] chars = "abc";
char[] backdoor = chars;
string s = chars;
assert (s == "abc");
backdoor.front = 'k';
assert (s == "abc"); // fails. not so immutable, huh?
???
backdoor and s do not denote th
spir wrote:
> On Sat, 20 Nov 2010 15:22:37 +0100
> Tomek Sowiński wrote:
>
>> > I find this proposal really necessary. But aren't there two issues
>> > here? * Comparison (for lookup) by value equality should not care about
>> > qualifiers (ie compare raw content, here plain array memory areas).
On 11/20/2010 05:09 PM, spir wrote:
???
backdoor and s do not denote the same element. One is a mutable array, the other is
immutable. Why should changing backdoor affect s? Whether backdoor and chars denote the
same array depends on whether "=" copies or not dyn arrays. But from immutable
str
On Sat, 20 Nov 2010 15:22:37 +0100
Tomek Sowiński wrote:
> > I find this proposal really necessary. But aren't there two issues here?
> > * Comparison (for lookup) by value equality should not care about
> > qualifiers (ie compare raw content, here plain array memory areas).
> > * Assignment sh
Andrei Alexandrescu napisał(a):
TDPL has an example that can be reduced as follows:
void main() {
uint[string] map;
foreach (line; stdin.byLine()) {
++map[line];
}
}
byLine reuses its buffer so it exposes it as char[]. Therefore,
attempting to use map[line] will fail. The prog
Dnia 20-11-2010 o 13:33:29 spir napisał(a):
I find this proposal really necessary. But aren't there two issues here?
* Comparison (for lookup) by value equality should not care about
qualifiers (ie compare raw content, here plain array memory areas).
* Assignment should perform "qualificatio
On 2010-11-20 03:07:57 -0500, Andrei Alexandrescu
said:
TDPL has an example that can be reduced as follows:
void main() {
uint[string] map;
foreach (line; stdin.byLine()) {
++map[line];
}
}
byLine reuses its buffer so it exposes it as char[]. Therefore,
attempting to use map[l
On Sat, 20 Nov 2010 00:07:57 -0800
Andrei Alexandrescu wrote:
> TDPL has an example that can be reduced as follows:
>
> void main() {
>uint[string] map;
>foreach (line; stdin.byLine()) {
> ++map[line];
>}
> }
>
> byLine reuses its buffer so it exposes it as char[]. Therefore,
On 20-nov-10, at 09:07, Andrei Alexandrescu wrote:
TDPL has an example that can be reduced as follows:
void main() {
uint[string] map;
foreach (line; stdin.byLine()) {
++map[line];
}
}
byLine reuses its buffer so it exposes it as char[]. Therefore,
attempting to use map[line] will f
Andrei Alexandrescu wrote:
> TDPL has an example that can be reduced as follows:
>
> void main() {
>uint[string] map;
>foreach (line; stdin.byLine()) {
> ++map[line];
>}
> }
>
> byLine reuses its buffer so it exposes it as char[]. Therefore,
> attempting to use map[line] will fa
TDPL has an example that can be reduced as follows:
void main() {
uint[string] map;
foreach (line; stdin.byLine()) {
++map[line];
}
}
byLine reuses its buffer so it exposes it as char[]. Therefore,
attempting to use map[line] will fail. The program compiled and did the
wrong thing be
22 matches
Mail list logo