On Thu, 02 Apr 2009 03:56:35 +0200, Trass3r wrote:
>I came across another strange bug(?):
>Using const, static const or auto instead of enum makes it work.
>Using the foreach way also works with enum.
>
>void main()
>{
> enum members = ["foo", "bar"];
> for (uint i=0; i// foreach
On Thu, 02 Apr 2009 00:07:56 +0200, Trass3r wrote:
>Max Samukha schrieb:
>> On Wed, 01 Apr 2009 23:22:40 +0200, Trass3r wrote:
>>
>>> OMG, I knew the recursion base case was missing, but I couldn't imagine
>>> how to represent "nothing". Of course, an empty tuple.
>>>
>>> But the reason I post
Trass3r wrote:
I came across another strange bug(?):
Using const, static const or auto instead of enum makes it work.
Using the foreach way also works with enum.
void main()
{
enum members = ["foo", "bar"];
for (uint i=0; istd.encoding.EncodingSchemeASCIIà‘B ANSI_X3.4-1968
Trass3r wrote:
> I came across another strange bug(?):
> Using const, static const or auto instead of enum makes it work.
> Using the foreach way also works with enum.
>
> void main()
> {
> enum members = ["foo", "bar"];
> for (uint i=0; i //foreach (i; Sequence!(members.length))
>
I came across another strange bug(?):
Using const, static const or auto instead of enum makes it work.
Using the foreach way also works with enum.
void main()
{
enum members = ["foo", "bar"];
for (uint i=0; istd.encoding.EncodingSchemeASCIIà‘B ANSI_X3.4-1968 ’B
Max Samukha schrieb:
On Wed, 01 Apr 2009 23:22:40 +0200, Trass3r wrote:
OMG, I knew the recursion base case was missing, but I couldn't imagine
how to represent "nothing". Of course, an empty tuple.
But the reason I posted is cause that bug(?) is still present.
dmd doesn't crash anymore, but
On Wed, 01 Apr 2009 23:22:40 +0200, Trass3r wrote:
>
>OMG, I knew the recursion base case was missing, but I couldn't imagine
>how to represent "nothing". Of course, an empty tuple.
>
>But the reason I posted is cause that bug(?) is still present.
>dmd doesn't crash anymore, but using const stil
Max Samukha schrieb:
On Wed, 01 Apr 2009 20:54:12 +0200, Trass3r wrote:
template Sequence(size_t count, size_t index = 0)
{
static if (index < count)
alias Tuple!(index, Sequence!(count, index + 1)) Sequence;
}
There was ellipsis to suggest that you should terminate the recursion
pr
On Wed, 01 Apr 2009 20:54:12 +0200, Trass3r wrote:
>template Sequence(size_t count, size_t index = 0)
>{
>static if (index < count)
> alias Tuple!(index, Sequence!(count, index + 1)) Sequence;
>}
There was ellipsis to suggest that you should terminate the recursion
properly :) Sorry
t
Trass3r schrieb:
enum members = __traits(allMembers, Class);
foreach (i; Sequence!(members.length))
{
static if (isFunction!(Class, members[i]))
{
foreach (j; __traits(getVirtualFunctions, Class,
members[i]))
writefln(members[i], ": ", typei
Trass3r schrieb:
foreach (member; __traits (allMembers, Class))
{
foreach (overload; __traits (getVirtualFunctions, Class, member))
{
// do stuff
}
}
omg, those bugs are known for nearly 2 years now.
http://d.puremagic.com/issues/show_bug.cgi?id=1386
http://d.puremagic.com/
Trass3r wrote:
Don schrieb:
That situation should be much better now that we have all of the
source code. If something changes, it'll be really easy to find
exactly what caused the change.
Well, if dmd was available in a source control repository we could
really easily track the changes.
A
Don schrieb:
That situation should be much better now that we have all of the source
code. If something changes, it'll be really easy to find exactly what
caused the change.
Well, if dmd was available in a source control repository we could
really easily track the changes.
Christopher Wright wrote:
Trass3r wrote:
Christopher Wright schrieb:
Buggy __traits is the major reason I'm not on d2. If __traits were
not buggy, I could do, god, so many things!
Though it would be even better to have the runtime equivalent.
Any chance traits get fixed anytime soon?
I wa
Trass3r wrote:
Christopher Wright schrieb:
Buggy __traits is the major reason I'm not on d2. If __traits were not
buggy, I could do, god, so many things!
Though it would be even better to have the runtime equivalent.
Any chance traits get fixed anytime soon?
I was using __traits + CTFE aro
Christopher Wright schrieb:
Buggy __traits is the major reason I'm not on d2. If __traits were not
buggy, I could do, god, so many things!
Though it would be even better to have the runtime equivalent.
Any chance traits get fixed anytime soon?
Trass3r wrote:
Yeah extreeemely buggy. dmd also crashes if that enum members is changed
to const members or invariant members.
Buggy __traits is the major reason I'm not on d2. If __traits were not
buggy, I could do, god, so many things!
Though it would be even better to have the runtime equ
On Tue, 31 Mar 2009 13:53:02 +0200, Trass3r wrote:
>Max Samukha schrieb:
>>> So it is a tuple although the docs tell us it's an array?
>>>
>>
>> Yeah, __traits returns expressions of various types depending on the
>> Id. In case of getVirtualFunctions, it's a tuple expression. You may
>> want to
Max Samukha schrieb:
"variable main.main.i voids have no value"
__traits is buggy.
template isFunction(C, string member)
{
enum isFunction = is(typeof(mixin("C." ~ member)) == function);
}
void main()
{
//SpinLock lock;
enum members = __traits(allMembers, Class);
foreach (i;
Max Samukha schrieb:
So it is a tuple although the docs tell us it's an array?
Yeah, __traits returns expressions of various types depending on the
Id. In case of getVirtualFunctions, it's a tuple expression. You may
want to look through traits.c in dmd sources to see what's going on.
So th
On Tue, 31 Mar 2009 10:55:22 +0200, Max Samukha
wrote:
>On Mon, 30 Mar 2009 22:04:57 +0200, Trass3r wrote:
>
>>Max Samukha schrieb:
>>> It's possible to statically unroll the foreach's with a template
>>> generating a tuple of consequtive integers (not tested):
>>>
>>> template Sequence(size_t
On Mon, 30 Mar 2009 22:04:57 +0200, Trass3r wrote:
>Max Samukha schrieb:
>> It's possible to statically unroll the foreach's with a template
>> generating a tuple of consequtive integers (not tested):
>>
>> template Sequence(size_t count, size_t index = 0)
>> {
>>static if (index < count)
>>
Max Samukha schrieb:
It's possible to statically unroll the foreach's with a template
generating a tuple of consequtive integers (not tested):
template Sequence(size_t count, size_t index = 0)
{
static if (index < count)
alias Tuple!(index, Sequence!(count, index + 1)) Sequence;
..
On Mon, Mar 30, 2009 at 5:13 PM, Tomas Lindquist Olsen
wrote:
> On Mon, Mar 30, 2009 at 5:11 PM, Jarrett Billingsley
> wrote:
>> On Mon, Mar 30, 2009 at 10:57 AM, Max Samukha
>> wrote:
Also the following doesn't work with dmd, returns 0 for all members:
Base base = new Base;
aut
On Mon, Mar 30, 2009 at 11:13 AM, Tomas Lindquist Olsen
wrote:
>>> getMembers has not been implemented, AFAIK
>>
>> It has in LDC ;)
>>
>
> I think we need D2 support first ;)
I was talking about the RTTI getMembers function :)
On Mon, Mar 30, 2009 at 5:11 PM, Jarrett Billingsley
wrote:
> On Mon, Mar 30, 2009 at 10:57 AM, Max Samukha
> wrote:
>>>Also the following doesn't work with dmd, returns 0 for all members:
>>>
>>>Base base = new Base;
>>>auto members = __traits(allMembers, typeof(base));
>>>foreach(m; members)
>>
On Mon, Mar 30, 2009 at 10:57 AM, Max Samukha
wrote:
>>Also the following doesn't work with dmd, returns 0 for all members:
>>
>>Base base = new Base;
>>auto members = __traits(allMembers, typeof(base));
>>foreach(m; members)
>> writefln(base.classinfo.getMembers(m).length);
>
> getMembers has
On Mon, 30 Mar 2009 15:06:09 +0200, Trass3r wrote:
>Shouldn't __traits return Tuples instead of arrays (esp. allMembers) to
>allow sophisticated compile time reflection?
>Currently it seems impossible to do something along the lines of
>
>foreach (member; __trait
Shouldn't __traits return Tuples instead of arrays (esp. allMembers) to
allow sophisticated compile time reflection?
Currently it seems impossible to do something along the lines of
foreach (member; __traits (allMembers, Class))
{
foreach (overload; __traits (getVirtualFunctions,
29 matches
Mail list logo