[Issue 3866] anonymous delegate with default parameters cross-talks to another anonymous delegate

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3866


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||clugd...@yahoo.com.au
   Severity|normal  |critical


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5750] Allow pure functions to have lazy arguments

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5750



--- Comment #2 from Don clugd...@yahoo.com.au 2011-03-18 23:31:18 PDT ---
(In reply to comment #1)
 I definitely like this idea, but I am a bit worried that it will be somewhat
 buggy if integrated at present. I believe that there are at least a couple of
 bugs (such as bug# 3833 ) related delegates not dealing with attributes such 
 as
 const and pure properly, and you can end up with attributes being ignored when
 they shouldn't be. That doesn't necessarily mean that this shouldn't be
 integrated right now, but it _does_ mean that the result could be buggy.

Bug 3833 is totally unrelated to this. I have looked at all bugs which use the
word lazy and none influence this. 
I've also looked at all open bugs which use the word delegate and also failed
to find anything which influence this one.
Bug 1818 is more related, but still isn't a problem.

The main reason that none of those existing bugs cause problems is that
enhancement bug 809 has NOT been accepted and fixed. This means that although
'lazy' is internally implemented using delegates, there are very few places in
the compiler where that fact is exposed. It stays as a lazy parameter almost
all of the time, which isolates it from the other issues.


Also worth noting: the patch fixes bug 5475, and would make fixing bug 5476
trivial.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4122] More handy BigInt.toString()

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4122


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||FIXED


--- Comment #2 from Don clugd...@yahoo.com.au 2011-03-18 23:33:50 PDT ---
Marking this as fixed, since you can just use writefln() in 2.051 and later.
(as added in the changeset).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3656] delegate should specify 'this' decorations

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3656


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #2 from Don clugd...@yahoo.com.au 2011-03-18 23:35:58 PDT ---
This seems to be a duplicate of bug 1983

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 1983] Big Hole in Const System

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1983


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #4 from Don clugd...@yahoo.com.au 2011-03-18 23:36:27 PDT ---
Bug 3656 seems to be another example of this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5752] New: Incorrect memoisation during function parameter name introspection

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5752

   Summary: Incorrect memoisation during function parameter name
introspection
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: johnaston@gmail.com


--- Comment #0 from John Aston johnaston@gmail.com 2011-03-19 04:04:52 
PDT ---
import std.stdio;

int funcOne(int paramOne)
{
return paramOne + 1;
}

int funcOther(int paramOther)
{
return paramOther + 1;
}

void printFunc(alias f)()
{
writeln(__traits(identifier,f), : ,(typeof(f)).stringof);
}

void main()
{
printFunc!funcOne();
printFunc!funcOther();
}

The above code returns on dmd.2.052:
funcOne : int function(int paramOne)
funcOther : int function(int paramOne)

Since the stringof property goes via the type rather than the alias, two
functions with different parameter names but the same type signature will be
confused.  The extraction of the parameter names I find very useful for
automatic function reflection.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5750] Allow pure functions to have lazy arguments

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5750


bearophile_h...@eml.cc changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc


--- Comment #3 from bearophile_h...@eml.cc 2011-03-19 05:27:08 PDT ---
(In reply to comment #2)

Thank you for this bug report, Don, I was thinking about opening it.

 Also worth noting: the patch fixes bug 5475,

Do you mean bug 5745?


Also, this helps bug 5746 too.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5753] New: Disallow map() of void function

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5753

   Summary: Disallow map() of void function
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: accepts-invalid
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-03-19 07:11:03 PDT ---
This code compiles with no errors (DMD 2.052), but in my opinion it has to
raise a compile-time error, because map() must statically refuse functions that
return void:


import std.algorithm;
void foo() {}
void main() {
int[] data = [1, 2, 3];
map!((int i){ return foo(); })(data);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5753] Disallow map() of void function

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5753



--- Comment #1 from bearophile_h...@eml.cc 2011-03-19 07:12:24 PDT ---
A simpler example:


import std.algorithm;
void foo(int x) {}
void main() {
int[] data = [1, 2, 3];
map!foo(data);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5754] New: 'glue.c' assertion failure with map(filter)

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5754

   Summary: 'glue.c' assertion failure with map(filter)
   Product: D
   Version: D2
  Platform: x86
OS/Version: Windows
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-03-19 07:22:11 PDT ---
import std.algorithm;
void main() {
int[] a = [1];
map!((int i){ return filter!((int j){ return i; })(a); })(a);
}


With DMD 2.052 gives:
Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'


Equivalent Python 2.6 code:

 a = [1]
 map(lambda i: filter(lambda j: i, a), a)
[[1]]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5754] 'glue.c' assertion failure with map(filter)

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5754


kenn...@gmail.com changed:

   What|Removed |Added

 CC||kenn...@gmail.com


--- Comment #1 from kenn...@gmail.com 2011-03-19 13:23:04 PDT ---
Any chance it is the same as issue 4129?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5754] 'glue.c' assertion failure with map(filter)

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5754


kenn...@gmail.com changed:

   What|Removed |Added

 OS/Version|Windows |All


--- Comment #2 from kenn...@gmail.com 2011-03-19 13:58:32 PDT ---
Reduced test case (I think):

--


void x(alias pred)() {
pred();
}

void main() {
x!((){
int i;  // declare in outer scope
x!((){
cast(void) i;   // access in inner scope
});
});
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4414] ICE(cgcs.c) Taking item of static array returned by function

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4414



--- Comment #5 from kenn...@gmail.com 2011-03-19 16:47:22 PDT ---
*** Issue 5755 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5755] Internal error in cgcs.c

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5755



--- Comment #2 from bearophile_h...@eml.cc 2011-03-19 17:06:50 PDT ---
(In reply to comment #1)
 Obviously the same class of bug you've reported 8 months ago.

I am sorry, and thank you for spotting the duplication :-)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5756] New: amap() and maybe afilter() too

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5756

   Summary: amap() and maybe afilter() too
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-03-19 17:09:37 PDT ---
I suggest to add to Phobos functions like amap() and maybe afilter() too.

amap() means array(map())
afilter() means array(filter())


Rationale:

- Functions like sum() are used all the time, Python programmers use it
thousands of times.
- In some situations a specialized version is faster, I have shown this about
sum() in an enhancement request (Andrei has then tried to generalize this
suggestion of mine again);
- array(map()) uses twice the number of parentheses of amap(). Haskell syntax
shows very well why too many parentheses make functional-style code needlessly
harder to read.
- Experience shows me that in D you can't use lazy things as much as you use in
Haskell. This means that very often I have to convert the results of D
map()/filter() to true arrays.
- sum() is a semantic chunk, while reduce!q{a+b}() is not as explicit in its
purpose, it's not a single chunk. You are able to speed up your coding if you
need to use less chunks.
- The number of nearly duplicated functions to add is quite limited.

But such functions aren't orthogonal, you can build them with few other small
things. In Python std library you see functions that aren't orthogonal, but
they are handy, like ifilterfalse() and starmap():
http://docs.python.org/library/itertools.html

You see something similar in the Haskell Prelude (it's a standard module loaded
and compiled before any other), a very well designed piece of code:
http://www.haskell.org/onlinereport/standard-prelude.html

It contains un-orthogonal functions like:

concatMap :: (a - [b]) - [a] - [b]
concatMap f = concat . map f


zipWith  :: (a-b-c) - [a]-[b]-[c]
zipWith z (a:as) (b:bs)
 =  z a b : zipWith z as bs
zipWith _ _ _=  []


zip  :: [a] - [b] - [(a,b)]
zip  =  zipWith (,)


putStrLn   :: String - IO ()
putStrLn s =  do putStr s
 putStr \n


print  :: Show a = a - IO ()
print x=  putStrLn (show x)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5743] readf cannot read wchar or dchar from UTF-8 stdin

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5743


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #1 from Don clugd...@yahoo.com.au 2011-03-19 17:14:45 PDT ---
This is marked as 'regression'. What previous version did it work with?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5743] readf cannot read wchar or dchar from UTF-8 stdin

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5743


Ali Cehreli acehr...@yahoo.com changed:

   What|Removed |Added

   Severity|regression  |normal


--- Comment #2 from Ali Cehreli acehr...@yahoo.com 2011-03-19 17:49:29 PDT ---
regression turns out to be my mistake. I just went back more than a dozen dmd
versions and see that std.stdio.readf (or File.readf) is pretty new.

I've been using std.cstream.din, which used to work better than stdio.readf.
Thinking that they must be using the same underlying format functions I thought
that this was a regression.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 5686] Explicit template instantiation with __FILE__ and __LINE__ associates those symbols with the declaration

2011-03-19 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5686


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au
   Severity|regression  |normal


--- Comment #7 from Don clugd...@yahoo.com.au 2011-03-19 18:19:11 PDT ---
This isn't a regression. It didn't work in DMD2.000 either.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---