<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hm.. while it makes sense that technically an immutable(X[]) is not
an input range for the mentioned reason, practically it does not
make sense not to allow such arrays in functions like startsWith.
Apart from the obscure range related cause, there is no obvious
reason why this should be the case. For any non-expert D user I
would expect this to be very confusing and annoying for the rest. So
well, for me looking from the outside, this still looks like a
regression although technically it maybe is not.<br>
<br>
Am 27.10.2010 22:58, schrieb David Simcha:
<blockquote
cite="mid:AANLkTikhvQN8gNM=YAWAkdNKc1cFPSocVbL32HRJCrQ5@mail.gmail.com"
type="cite">This is not a regression. The example code you posted
was never supposed to work, but relied on bugs in DMD to work
nonetheless. An immutable(char[]) is not an input range since you
can't call popFront() on it. You used to be able to because of
Bug 3534 (<a moz-do-not-send="true"
href="http://d.puremagic.com/issues/show_bug.cgi?id=3534">http://d.puremagic.com/issues/show_bug.cgi?id=3534</a>).
I added code to Phobos to explicitly disable this, so that until
3534 gets fixed people avoid writing code that relies on it.<br>
<br>
<div class="gmail_quote">On Wed, Oct 27, 2010 at 3:47 PM, Sönke
Ludwig <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:ludwig@informatik.uni-luebeck.de">ludwig@informatik.uni-luebeck.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
There seems to be a regression in std.algorithm.startsWith.
With 2.049 this still worked:<br>
<br>
invariant string s = "Hello, World!";<br>
bool res = s.startsWith("Hello");<br>
<br>
now the template cannot be matched anymore. Remove the
invariant and it works.<br>
<br>
Am 27.10.2010 21:13, schrieb Walter Bright:
<div>
<div class="h5"><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
Fix is uploaded.<br>
<br>
Don Clugston wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt
0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
On 27 October 2010 16:50, Stephan Dilly <<a
moz-do-not-send="true"
href="mailto:Dilly@funatics.de" target="_blank">Dilly@funatics.de</a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt
0pt 0.8ex; border-left: 1px solid rgb(204, 204,
204); padding-left: 1ex;">
On 27.10.2010 16:14, Don Clugston wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt
0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
On 27 October 2010 15:29, Stephan Dilly<<a
moz-do-not-send="true"
href="mailto:Dilly@funatics.de" target="_blank">Dilly@funatics.de</a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt
0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
204, 204); padding-left: 1ex;">
On 27.10.2010 14:51, Stephan Dilly wrote:<br>
<blockquote class="gmail_quote" style="margin:
0pt 0pt 0pt 0.8ex; border-left: 1px solid
rgb(204, 204, 204); padding-left: 1ex;">
<blockquote class="gmail_quote" style="margin:
0pt 0pt 0pt 0.8ex; border-left: 1px solid
rgb(204, 204, 204); padding-left: 1ex;">
<a moz-do-not-send="true"
href="http://ftp.digitalmars.com/dmd1beta.zip"
target="_blank">http://ftp.digitalmars.com/dmd1beta.zip</a><br>
<a moz-do-not-send="true"
href="http://ftp.digitalmars.com/dmd2beta.zip"
target="_blank">http://ftp.digitalmars.com/dmd2beta.zip</a><br>
</blockquote>
1) the client still says it is version 2.049<br>
<br>
2) there seems to be a regression with pure
opCall methods introduced.<br>
The<br>
following code used to build with dmd2049 but
now does not:<br>
<br>
<br>
struct Foo<br>
{<br>
static Foo opCall(in Foo _f) pure<br>
{<br>
return Foo;<br>
}<br>
}<br>
<br>
instead the compiler issues the following
error:<br>
"Error: struct bug.Foo no size yet for forward
reference"<br>
<br>
the workaround would be to remove the pure but
that is no option for my<br>
codebase full of pure opCalls.<br>
<br>
<br>
regards,<br>
Stephan<br>
</blockquote>
Ok to be fair, this is the correct code that
works in dmd2049 and does<br>
not<br>
in the beta:<br>
<br>
struct Foo<br>
{<br>
static Foo opCall(in Foo _f) pure<br>
{<br>
return _f;<br>
}<br>
}<br>
</blockquote>
That is happening because in mtype.c, line 5013,
it's trying to work<br>
out which form of purity the function is. It can't
do this for a<br>
struct, until it knows if the struct has any
pointer members. This is<br>
a problem if it's a member function.<br>
I don't know if it really needs to determine
purity level so early on.<br>
_______________________________________________<br>
dmd-beta mailing list<br>
<a moz-do-not-send="true"
href="mailto:dmd-beta@puremagic.com"
target="_blank">dmd-beta@puremagic.com</a><br>
<a moz-do-not-send="true"
href="http://lists.puremagic.com/mailman/listinfo/dmd-beta"
target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-beta</a><br>
<br>
</blockquote>
I don't know either ;)<br>
Does that mean that static pure opCalls wont be
possible from now on ?<br>
</blockquote>
<br>
Your code should continue to work. It's a regression.<br>
<br>
</blockquote>
_______________________________________________<br>
dmd-beta mailing list<br>
<a moz-do-not-send="true"
href="mailto:dmd-beta@puremagic.com" target="_blank">dmd-beta@puremagic.com</a><br>
<a moz-do-not-send="true"
href="http://lists.puremagic.com/mailman/listinfo/dmd-beta"
target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-beta</a><br>
</blockquote>
<br>
_______________________________________________<br>
dmd-beta mailing list<br>
<a moz-do-not-send="true"
href="mailto:dmd-beta@puremagic.com" target="_blank">dmd-beta@puremagic.com</a><br>
<a moz-do-not-send="true"
href="http://lists.puremagic.com/mailman/listinfo/dmd-beta"
target="_blank">http://lists.puremagic.com/mailman/listinfo/dmd-beta</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
dmd-beta mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dmd-beta@puremagic.com">dmd-beta@puremagic.com</a>
<a class="moz-txt-link-freetext" href="http://lists.puremagic.com/mailman/listinfo/dmd-beta">http://lists.puremagic.com/mailman/listinfo/dmd-beta</a></pre>
</blockquote>
<br>
</body>
</html>