[Issue 5804] map! needs to fail on void functions + I'd like a mapCall function

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5804


Vladimir thecybersha...@gmail.com changed:

   What|Removed |Added

 CC||thecybersha...@gmail.com


--- Comment #1 from Vladimir thecybersha...@gmail.com 2011-04-01 01:23:15 PDT 
---
Looks like a duplicate of issue 5753.

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


[Issue 5657] Temporary object destruction

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5657



--- Comment #1 from SHOO zan77...@nifty.com 2011-04-01 04:44:14 PDT ---
I tested following commit:
https://github.com/D-Programming-Language/dmd/commit/e764b3949ae0f95f8fc4d7d2e9114e29fee12493

with following code:
http://ideone.com/Yqomf

and result is here:
http://ideone.com/qfBnx


CONCLUTION:

Almost!
Its behavior is right except a case to ignore without storing away a temporary
object produced in a return value to a variable.

+--+--+--++-+
| source   | distination  | postblit | destructor | correctness |
+--+--+--++-+
| constructor  | parameter|x | o  |  OK |
| constructor  | return value |x | x  |  OK |
| constructor  | variable |x | o  |  OK |
| constructor  | no operate   |x | o  |  OK |
| return value | parameter|x | o  |  OK |
| return value | return value |x | x  |  OK |
| return value | variable |x | o  |  OK |
| return value | no operate   |x |_x_ | _NG_|
| variable | parameter|o | o  |  OK |
| variable | return value |o | o  |  OK |
| variable | variable |o | o  |  OK |
| variable | no operate   | (error)  |  (error)   |  OK |
+--+--+--++-+
 (*) x ... not called / o ... called

Minimized case is here:
-
import std.stdio;

struct A{
this(int x) {writeln(ctor);}
~this(){writeln(dtor);}
}

A foo() { return A(1); }
void main() {
foo();
}
-
$ dmd -run main
ctor
-

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


[Issue 5805] New: std.regex match captures property horribly broken

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5805

   Summary: std.regex match captures property horribly broken
   Product: D
   Version: D2
  Platform: x86
OS/Version: All
Status: NEW
  Severity: critical
  Priority: P2
 Component: Phobos
AssignedTo: nob...@puremagic.com
ReportedBy: dmitry.o...@gmail.com


--- Comment #0 from Dmitry Olshansky dmitry.o...@gmail.com 2011-04-01 
05:57:13 PDT ---
void main(){
auto r = regex(`(a)(b)?(c*)`);
writeln(r.captures);
auto m = acc.match(r);
writeln(m.hit); 
foreach(c;m.captures)
writeln(c);
}

Output:
3
acc
acc
a
core.exception.RangeError@std.regex(1719): Range violation

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


[Issue 5729] taking the address of a @property doesn't work

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5729


Harry Vennik htven...@zonnet.nl changed:

   What|Removed |Added

 CC||htven...@zonnet.nl


--- Comment #1 from Harry Vennik htven...@zonnet.nl 2011-04-01 09:32:40 PDT 
---
The point is that you are getting the address of the property function, not the
address of the ref return value. Adding the () changes this, because the () is
evaluated before .

So the real problem is a syntax ambiguity.

It depends on the context how the reference to the property is evaluated. Try
this:
typeof(a.bla)// returns  int
typeof(a.bla)  // returns  int delegate() @property ref

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


[Issue 5729] taking the address of a @property doesn't work

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5729



--- Comment #2 from Harry Vennik htven...@zonnet.nl 2011-04-01 09:42:57 PDT 
---
Really amazing:

typeof(A.bla)  // int
typeof(A.bla)   // int function() @property ref
typeof(*A.bla) // int

(The difference with the previous post is that I am referring to class A
instead of its instance a.)

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


[Issue 4360] Allow intrinsics in core.bitop to operate as intrinsics

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4360


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #6 from Walter Bright bugzi...@digitalmars.com 2011-04-01 
14:21:31 PDT ---
https://github.com/D-Programming-Language/dmd/commit/f462124a9284fcd3b0f45cc0fb6d59d5aaa74c04

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


[Issue 5788] Return [] array

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5788


Vladimir thecybersha...@gmail.com changed:

   What|Removed |Added

 CC||thecybersha...@gmail.com


--- Comment #1 from Vladimir thecybersha...@gmail.com 2011-04-01 19:03:12 PDT 
---
No!

Often it is extremely useful to distinguish an empty array from a null one.
(You do that with is null).

Fixing this will break a lot of my code.

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


[Issue 5788] Return [] array

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5788



--- Comment #2 from Vladimir thecybersha...@gmail.com 2011-04-01 19:08:43 PDT 
---
Erm, never mind, [] still creates a null array. I just remembered I had to do
something more tricky in my code to make empty non-null arrays.

https://github.com/CyberShadow/RABCDAsm/blob/cecff913/abcfile.d#L1094

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


[Issue 5233] [patch] std.range.put accepts *any* element type when putting to an array.

2011-04-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5233



--- Comment #4 from Rob Jacques sandf...@jhu.edu 2011-04-01 22:01:14 PDT ---
Patch version 5.
*** API Addition ***
Optional template boolean parameter asArray. If true, put bypasses testing
r.put(e), r.put(e[]), r(e) and r(e[]). This allows templated user defined put
routines to accept all valid put types without duplicating all of put's
transforms/code snippets. For example:

struct Stack(T) {
put(U item) if( isOutputRange!(T[],U) ) {
static if( is(U:T) ) {
// put one item onto the stack
} else {
.put!(typeof(this),U,true)(this,item);
}
}
}

* Updated documentation to reflect changes
* Removal of all static asserts. static asserts do not currently compose well
with is(typeof(...)) / __traits(compiles,...) statements. Instead, the error
message is left as a single line statement. This causes a normal compilation
error with a reasonable error message, since the error info is embedded in the
bad string, the value of which is included in the error message.
* All string put string and string put char cases are UTF correct.
* The r(e) snippet now filters out types with ctors but not opCall.
* Support was added for index only and foreach-able E types.
* Simplification of snippets and code layout


[Patch]

/** Outputs $(D e) to $(D r). The exact effect is dependent upon the two types.
Several cases are accepted, as described below. The code snippets are
attempted in order, and the first to compile wins and gets evaluated.
Setting asArray to true will skip code snippets using user defined
$(D put) and opCall methods, allowing templated user defined $(D put)
methods to reuse some of $(D put)'s code snippets.

$(BOOKTABLE ,

$(TR $(TH Code Snippet) $(TH Scenario))

$(TR $(TD $(D isSomeString!R  isSomeString!E ))
 $(TD $(D R) is a mutable string and $(D E) is a string.))

$(TR $(TD $(D isSomeString!R  isSomeChar!E ))
 $(TD $(D R) is a mutable string and $(D E) is a character.))

$(TR $(TD $(D r.put(e);))
 $(TD $(D R) defines a method $(D put) accepting an $(D E).))

$(TR $(TD $(D r.put([ e ]);))
 $(TD $(D R) defines a method $(D put) accepting an $(D E[]).))

$(TR $(TD $(D r.front = e; r.popFront();))
 $(TD $(D R) is an input range and $(D e) is assignable to $(D r.front).))

$(TR $(TD $(D foreach(v; e) put(r,v)))
 $(TD Copying range $(D E) to range $(D R).))

$(TR $(TD $(D foreach(i;0..e.length) put(r,e[i])))
 $(TD Copying range $(D E) to range $(D R).))

$(TR $(TD $(D r(e);))
 $(TD $(D R) is e.g. a delegate accepting an $(D E).))

$(TR $(TD $(D r([ e ]);))
 $(TD $(D R) is e.g. a $(D delegate) accepting an $(D E[]).))

)
 */

void put(R, E, bool asArray = isArray!R )(ref R r, E e) {
static if(isSomeString!R  isSomeString!E  is(typeof(r[0]=r[0])) ){
static if( (typeof(r[0])).sizeof != E.sizeof ) {
foreach( typeof(r[0]) v; e)
put(r,v);
} else {
assert(e.length = r.length);
r[0..e.length] = e[];
r = r[e.length..$];
}
} else static if(isSomeString!R  isSomeChar!E  is(typeof(r[0]=r[0])) ){
static if( (typeof(r[0])).sizeof  E.sizeof ) {
// Transcoding is required to support char[].put(dchar)
typeof(r[0])[(typeof(r[0])).sizeof == 1 ? 4 : 2] encoded;
auto len = std.utf.encode(encoded, e);
put(r,encoded[0 .. len]);
} else {
assert(!r.empty);
r[0] = e;
r = r[1..$];
}
} else static if( !asArray  __traits(compiles,  r.put(  e  ))  ){
  r.put(  e  );
} else static if( !asArray  __traits(compiles,  r.put((e)[0..1]   ))  ){
  r.put((e)[0..1]   );
} else static if (isInputRange!R  is(typeof(r.front = e) )) {
r.front = e;
r.popFront();
} else static if(__traits(compiles,{foreach(v; e)  put(r,  v );})){
foreach(v; e)  put(r,  v );
} else static if(__traits(compiles,{foreach(i;0..e.length) put(r,e[i]);})){
foreach(i;0..e.length) put(r,e[i]);
} else static if( _putCall!(R,E,asArray)  is(typeof( r( e  )) )){
   r( e  );
} else static if( _putCall!(R,E,asArray)  is(typeof( r( (e)[0..1] )) )){
   r( (e)[0..1] );
} else {
// @@@BUG@@@ Static asserts can't be combined with is(typeof(put(r,e)))
Can't put a ~E.stringof~ into a ~R.stringof;
}
}

// Helper template for put(): filters out opCall from ctors
private template _putCall(R, E, bool asArray = false) {
static if(asArray)enum _putCall = false;
else static if( is(R==class) || is(R==struct) || is(R==union) )