[Issue 2633] New: incorrect ModuleInfo declaration in object.di

2009-01-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2633

   Summary: incorrect ModuleInfo declaration in object.di
   Product: D
   Version: 2.023
  Platform: PC
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Phobos
AssignedTo: bugzi...@digitalmars.com
ReportedBy: to...@famolsen.dk


import std.stdio;

class M : ModuleInfo
{
}

void main()
{
writefln(M.classinfo.init.length);
writefln(ModuleInfo.classinfo.init.length);
}

running this test case should print two identical numbers, but it doesn't ...


-- 



[Issue 2634] New: Function literals are non-constant.

2009-01-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2634

   Summary: Function literals are non-constant.
   Product: D
   Version: 2.023
  Platform: All
OS/Version: All
Status: NEW
  Keywords: rejects-valid
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: bugzi...@digitalmars.com
ReportedBy: burton-rad...@shaw.ca


This code fails compilation:

  void test () { }

  // Compiles okay.
  auto a = test;

  // Error: non-constant expression __funcliteral1
  auto b = function void () { }; 

As far as I can tell there is no reason for function literals to be
non-constant if they're not synthesized during runtime.


-- 



[Issue 2635] $ for user-defined slices should forward to value.length, not global __dollar. Also injected length must go.

2009-01-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2635





--- Comment #1 from schvei...@yahoo.com  2009-01-29 20:28 ---
I think expanding to length is not always correct, although I do agree that it
can be solved with the proposed method.

Length is not always the name of the term you would pass to a slice.

Example: sorted dictionary (Red-black tree based for instance).  A slice of
this container would use two key types as slice indexes.  So you would have to
define a property length that returns a key, which is super unintuitive for
people who are trying to use the length property outside a slicing operation
(imagine if the key type is string, your length has to return a string).

I think the opDollar would suit this rather well, but maybe call it opSliceEnd,
or something like that (to follow the spirit of current operator naming
scheme).


--