[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[grt-talk]Constructors
From: |
Nikodemus Siivola |
Subject: |
[grt-talk]Constructors |
Date: |
Sun, 30 Mar 2003 00:11:25 +0200 (EET) |
> I noticed today that if you don't pass the right types to constructors
> then bad things happen. Is there a way to turn on (or create) a
> debug/testing mode so that constructors will throw intelligent error
> messages?
>
> An example of the problem I was having was a line like,
> (grt-vector 0 0 0)
>
> Which bombs, but doesn't say way...Or at least in my code it didn't
> say why.
It wants single floats, not ints is the short answer. The long answer is
the there really should be two constructors:
* one that wants single floats to be used internally to have better type
checking and in order to avoid unnecessary type conversions.
* another that takes just about anything that it can convert into
single floats
> I was thinking maybe we could define some constants and check for them
> somewhere, and perhaps combine with eval-when-compile, so that we
> could enable a testing mode where you debug your scene. Then when you
> have it all tweaked you turn it off for efficiency.
I think that the scene building functions should not need to be optimized
for speed, but for user convenience: you need to get pretty spectacular
before the scene building time is significant -- especially compared to the
scene rendering time.
And yes, the whole scene building API needs to be rethought.
-- Nikodemus