On 15.11.2016 14:11, Rainer Schuetze wrote:


On 14.11.2016 21:26, Timon Gehr wrote:
On 14.11.2016 00:32, Steven Schveighoffer wrote:

A Foo[] can be stored in a Foo, because it doesn't need the size. But
yes, as soon as you start needing Appender functions, then the compiler
chokes.

It is a forward reference bug, but still a bug IMO. If you can store the
appender, then the compiler knows how big it has to be. So it should be
fine at that point.

Paging Timon, I'm betting your front end handles this just fine ;)

-Steve

It does. :)

Minimal example:

struct Appender(A){
    alias T = typeof({ A a; return a[0]; }());
    T[] data;
    void put(T item){ data~=item; }
}
struct Foo{ Appender!(Foo[]) fooAppender; }
Foo[] test(){
    Foo f;
    f.fooAppender.put(Foo());
    return f.fooAppender.data;
}
static assert(test().length==1);


Error with DMD, works with my front end.

Coincidentally, I've tried compiling your front end with latest dmd just
yesterday. There is one file missing, though: cent_.d. Could you please
commit this, too?
...

Oops. Thanks for pointing this out, I have committed it. (It's just a stub anyway: It's a wrapper around a long.)

The cent code commented out, I noticed your code is suffering from the
same issue as the OP (also happens for AAs, e.g. T[int]). A workaround
is to use void[] and wrap it in property functions.

I've fixed/worked around a number of issues in dmd with respect to
incomplete semantic analysis that happen with template mixins, but more
still pop up afterwards.
...

DMD 2.060 is the only version of DMD that builds the code.

Are there limitations to what the front end understands?

Yup. There are many features missing that are quite easy to implement but require work, and a few that are somewhat messy to specify (e.g. 'protected'). An incomplete list:

* UDA's
* Built-in members (init, stringof, min, max, ...)
* various forms of import statements
  - static, selective, renaming, ...
* Initialization of union fields
* anonymous structs & unions
  - Analysis & Lowering
* additional import paths & implicit object.d
* implicit inheritance from Object
* version declarations
* Associative arrays/Associative array literals
* module declarations
* (implicit) super constructor calls
  - default constructor call insertion
  - flow analysis
* Destructor and postblit calls
  - use flow analysis to optimize moves
* with statements
* associative arrays
* foreach statements
  - automatic decoding for string types
  - foreach over associative arrays
  - foreach over delegates
  - foreach over AliasSeq
* pattern matching in old-style template constraints
* explicit casts from/to class references
  - eg. to/from void* and to bool
* try-catch-finally statements
* scope guards
* initialization crossing check
* multi-argument struct constructors.
* struct postblit & destructors
* finish operator overloading support
* opDispatch
* member alias declarations aliasing members
  - correctly provide a this pointer
* visibility
  - package, protected
* alias this


Is it able to digest itself?

Not yet. (Mostly because of missing language features.)

That would be pretty impressive ;-)

I want to get there eventually. :)
Unfortunately I haven't had a lot of time to spend on this lately. Also, DMD 2.060 has quite many annoying bugs that slow down development.


Reply via email to