www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GDC and DMD incompatability, can both be used?

reply cy <dlang verge.info.tm> writes:
hunt/source/hunt/serialization/JsonSerializer.d:125:20: error: 
basic type expected, not foreach
   125 |             static foreach (string member; 
FieldNameTuple!T) {

I'm having a little trouble using the hunt library with gdc. Does 
gdc not support static foreach at all? Is there some way to write 
code that it can understand, which does the same thing?
Jul 10 2020
next sibling parent cy <dlang verge.info.tm> writes:
And OK yes I see gdc definitely does not support static foreach, 
but instead there's some sort of D compiler written in D compiled 
by GDC? That's just dmd, isn't it?

https://github.com/D-Programming-GDC/GDC/pull/550

He calls it "DDMD."
Jul 10 2020
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, Jul 11, 2020 at 04:28:32AM +0000, cy via Digitalmars-d-learn wrote:
 hunt/source/hunt/serialization/JsonSerializer.d:125:20: error: basic
 type expected, not foreach
   125 |             static foreach (string member; FieldNameTuple!T) {
 
 I'm having a little trouble using the hunt library with gdc. Does gdc
 not support static foreach at all? Is there some way to write code
 that it can understand, which does the same thing?
Which version of GDC are you using? Static foreach is a relatively new feature, and GDC may not have picked it up yet. GDC uses exactly the same front end as DMD (and LDC), so there is no fundamental incompatibility. The only issue is that GDC is tied to the GCC release cycle, so it may be a few releases behind DMD, and therefore lack some newer features. Eventually it will catch up, though. T -- When solving a problem, take care that you do not become part of the problem.
Jul 10 2020
prev sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Saturday, 11 July 2020 at 04:28:32 UTC, cy wrote:
   125 |             static foreach (string member; 
 FieldNameTuple!T) {
The word "static" there can probably be removed and have it work exactly the same way. Worth a try.
 Does gdc not support static foreach at all?
only the newest gdc does, version 10. version 9, in most package managers, doesn't include it. but if it is inside a function, normal foreach does the same thing anyway.
Jul 11 2020