[Issue 9788] -profile doesn't work if exceptions are thrown in the running program

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9788



--- Comment #1 from Walter Bright bugzi...@digitalmars.com 2013-03-28 
00:36:18 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1806

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


[Issue 4835] DMD should warn about integer overflow in computed constant

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4835



--- Comment #16 from Walter Bright bugzi...@digitalmars.com 2013-03-28 
00:39:03 PDT ---
(In reply to comment #15)
 Walter, what do you mean, screw? Is that a limitation of the dmd backend, or
 are you arguing that it is problematic in general? LLVM implements it, as
 bearophile points out...

Consider all the addressing modes used - they are all adds, with no overflow
checks. Secondly, they all rely on wraparound (overflow) arithmetic, after all,
that is how subtraction is done.

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


[Issue 9824] New: Emplace is broken

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9824

   Summary: Emplace is broken
   Product: D
   Version: unspecified
  Platform: All
OS/Version: All
Status: ASSIGNED
  Keywords: wrong-code
  Severity: major
  Priority: P2
 Component: Phobos
AssignedTo: monarchdo...@gmail.com
ReportedBy: monarchdo...@gmail.com


--- Comment #0 from monarchdo...@gmail.com 2013-03-28 04:30:01 PDT ---
Filing this because apparently it hasn't been filed yet.

Amongst others:
- Calls elaborate opAssign
- Fails on objects with disabled opAssign
- Fails to pre-blit T.init when using opAssign
- Fails on no-arg static arrays
- Fails to build from arg with alias this
- Doesn't always call the right construction scheme
- Calls static opCall

Proposed fix:
https://github.com/D-Programming-Language/phobos/pull/1082/files

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


[Issue 3412] DMD 1.x svn branch store string literal in mutable char*

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3412


Leandro Lucarella leandro.lucare...@sociomantic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


--- Comment #2 from Leandro Lucarella leandro.lucare...@sociomantic.com 
2013-03-28 07:23:26 PDT ---
I think this is extremely outdated and eventually was (at least partially)
addressed, so better to let it die.

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


[Issue 5348] Variable Length Arrays

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5348



--- Comment #7 from bearophile_h...@eml.cc 2013-03-28 12:03:43 PDT ---
See also for an alternative design:

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3532.html

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


[Issue 9825] New: Add ability to auto-generate a specific field constructor

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9825

   Summary: Add ability to auto-generate a specific field
constructor
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-03-28 
12:48:51 PDT ---
Let's say you have a Rectangle struct:

struct Rect
{
int x;
int y;
int width;
int height;
}

Later on you add two additional structures:

struct Point
{
int x;
int y;
}

struct Size
{
int width;
int height;
}

So as a convenience you want to enable constructing a Rect with these types:

struct Rect
{
int x;
int y;
int width;
int height;

/** Construct from Point and Size. */
this(Point point, Size size)
{
this.x = point.x;
this.y = point.y;
this.width = size.width;
this.height = size.height;
}
}

However this disables the default field-based constructor.

We should have the ability to explicitly reintroduce the field-based
constructor. 

But to avoid accidentally generating the field constructor for *any* field we
can take advantage of the 'default' keyword for marking which fields should be
part of a default ctor. For example:

struct S
{
// non-default ctor
this(string first, string last) { this.name = first ~ last; }  
string fullname;

default:
int field1;
int field2;
}

Here a default constructor would be generated that only initializes the fields
marked as 'default', in other words the above can be constructed with:

auto s1 = S(John, Doe);  // custom ctor
auto s2 = S(1, 2);  // default ctor

The benefit here is that a default ctor is only generated for fields marked as
default, meaning that introducing new non-default fields does not update the
default ctor.

Perhaps the feature could be incorporated for classes too.

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


[Issue 5348] Variable Length Arrays

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5348


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

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
   Platform|Other   |All
 Resolution||WONTFIX
 OS/Version|Windows |All


--- Comment #8 from Walter Bright bugzi...@digitalmars.com 2013-03-28 
13:02:08 PDT ---
1. VLAs are a failure in C99.

2. I'd prefer to deal with stack allocated arrays by optimization rather than
new syntax  semantics, i.e.:

int[] array = new int[5];

and determining that array[] can never leave its scope, and so can be allocated
on the stack.

3. Consider that static arrays are passed by value to functions, rather than by
reference. VLAs for static arrays mess this up.

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


[Issue 9826] New: import doesn't work with absolute paths

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9826

   Summary: import doesn't work with absolute paths
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: timothee.co...@gmail.com


--- Comment #0 from Timothee Cour timothee.co...@gmail.com 2013-03-28 
13:48:20 PDT ---
dmd -J. main.d //CT error
dmd -J/ main.d //works

main.d

void main(){enum x=import(__FILE__);}


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


[Issue 5348] Variable Length Arrays

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5348



--- Comment #9 from bearophile_h...@eml.cc 2013-03-28 15:55:17 PDT ---
Thank you for your comments.

 1. VLAs are a failure in C99.

I agree, let's invent something better.

My ideas have changed, and now I think it's better to define DSSAA in library
code that is recognized and managed in a special way by the compiler, as here
for C++:

http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3532.html

Ada2012 has added stack-allocated collections. Rust allows any thing you want
to be allocated on the stack, if you want. They know that sometimes heap
allocations are bad for performance.

Dynamic-size stack-allocated arrays (abbreviated to DSSAA) will be a base to
create several other stack-allocated collections for D, as in Ada (and in
future Rust).


 2. I'd prefer to deal with stack allocated arrays by optimization rather than
 new syntax  semantics, i.e.:
 
 int[] array = new int[5];
 
 and determining that array[] can never leave its scope, and so can be 
 allocated
 on the stack.

Your idea has problems:
1) Since some time Java has added escape analysis to stack-allocate some
objects and reduce a little the pressure on the GC. This feature is useful in
Java, but also it shows its limits, in many cases it fails, so it doesn't bring
a large improvement in Java.
2) I'd like DSSAA to be able to leave the scope (the simplest way to do this is
to dup on them, copying them on the heap. Below I show another way to do it).

A solution is to invent library-defined arrays that have a semantics different
from the regular dynamic arrays. See below.


 3. Consider that static arrays are passed by value to functions, rather
 than by reference. VLAs for static arrays mess this up.

A solution is to add a special value array to Phobos, as in that n3532, and
then let the D compiler manage it in a special way, allocating it on the stack
where possible (if you use it inside a struct its storage goes on the heap,
like a dynamic array).


In the following case foo creates a DSSAA and returns it. A DSSAA keeps its
lenght beside the data, in the stack frame. At the return point inside bar()
bar allocates another DSSAA on the stack (increasing the size of the stack
frame of bar) and copies the received data:


import std.collections: ValArray;
ValArray!int foo(int n) {
auto a = ValArray!int(n); // on the stack.
return a;
}
void bar() {
ValArray!int b = foo(5); // copied on the stack.
}


In this case foo() creates the DSSAA and calls bar with it. D just returns
pointer to the data on the stack frame plus length (so it's a kind of slice)
and then under the cover the data is also copied inside the stack frame of bar:

import std.collections: ValArray;
void foo(int n) {
auto a = ValArray!int(n);
bar(a);
}
void bar(ValArray!int b) {
}


Probably I have to open an enhancement request on this.

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


[Issue 5348] Variable Length Arrays

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=5348



--- Comment #10 from Walter Bright bugzi...@digitalmars.com 2013-03-28 
17:02:19 PDT ---
 Probably I have to open an enhancement request on this.

Since it's different, yes, but I think this is complex enough that it should be
done as a DIP, not a simple enhancement request.

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


[Issue 8880] Feature Request into both std.ascii std.uni isNewline

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8880


Nick Sabalausky cbkbbej...@mailinator.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||cbkbbej...@mailinator.com
 Resolution||DUPLICATE


--- Comment #2 from Nick Sabalausky cbkbbej...@mailinator.com 2013-03-28 
17:35:23 PDT ---
Duplicate of #9045. Closing this one because #9045 has more discussion.

*** This issue has been marked as a duplicate of issue 9045 ***

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


[Issue 9045] Feature request for std.asscii = function isNewline

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9045



--- Comment #11 from Nick Sabalausky cbkbbej...@mailinator.com 2013-03-28 
17:35:23 PDT ---
*** Issue 8880 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 9827] New: Duplicate file on command-line issues a bad diagnostic

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9827

   Summary: Duplicate file on command-line issues a bad diagnostic
   Product: D
   Version: D2
  Platform: All
OS/Version: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: andrej.mitrov...@gmail.com


--- Comment #0 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-03-28 
18:48:35 PDT ---
$ dmd test.d test.d

2.062:
 Error: module test from file test.d conflicts with another module test from 
 file
 test.d

2.063:
 Error: module test from file test.d must be imported as module 'test'

The error should be:
 Error: file test.d is passed more than once on the command-line

Or perhaps there should be no error and DMD should be smart enough to merge
duplicate file paths on the command-line.

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


[Issue 9827] Duplicate file on command-line issues a bad diagnostic

2013-03-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9827


Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

   Keywords||pull


--- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-03-28 
19:09:03 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1811

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