[Issue 2337] New: Can't set .length property in CTF.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 5 16:10:39 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2337

           Summary: Can't set .length property in CTF.
           Product: D
           Version: 1.035
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: aziz.kerim at gmail.com


The page for functions says that some "properties can be executed at compile
time", and it lists .length as one of those properties. Unfortunately it can
only be accessed by reading it, but assigning a value to it is not possible.

For example:

char[] ctf()
{
  // Create a table:
  char[][] table = [];
  // table.length = 250; // No simple enlargement.
  // Use ugly workaround:
  for (uint i; i < 250; i++)
    table ~= [];

  char[] code = "";
  // Create code from table.
  return code;
}

pragma(msg, ctf());

I think this shouldn't be too difficult to implement.


-- 



More information about the Digitalmars-d-bugs mailing list