FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Little announcement/Help needed

 
Post new topic   Reply to topic     Forum Index -> Ray
View previous topic :: View next topic  
Author Message
Linker



Joined: 06 Nov 2006
Posts: 29
Location: Almaty, Kazakhstan

PostPosted: Tue Jul 03, 2007 1:19 pm    Post subject: Little announcement/Help needed Reply with quote

I've made some progress in development. The new version will be available soon. It will include Pluecker and Quaternion classes, and some more.

However, I have more and more questions raising in my mind.

One terrible thing is the lack of constant references in D. Does anyone know how to handle it? For some time, all the functions that take structures as parameters had their parameters passed by value (yes, copying the contents all over).

Is this fine or not? I guess not, so I placed 'ref' everywhere I found. The thing is that 'ref' allows parameter to change, while most of the time parameters are constant.

How is this handled in D? Right now I have some nasty hacks in my code to pass 'const Vec3 vec3_zero = ...' to a function like 'void foo( ref Vec3 v )'. If I do a copy of vec3_zero, then compiler shuts up, but since a temporary is created, it should be sort of constant... (this is just my intuition Smile)

I've just stumbled across DMD 2.0. DMD 1.XX and DMD 2.XX: two different compilers? Can anybody shed some light on this?
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Jul 03, 2007 2:04 pm    Post subject: Reply with quote

passing structs by reference has been a long-standing thorn in side for D, since they are implicitly read/write (as you note). The big change for DMD 2.0 is a rewrite of the const/invariant/final semantics, part of which will support passing read-only structs by reference. However, the 2.0 compiler is experimental at this time -- stick with ref for now, and rely on documentation to ensure the users don't write to those structs Smile
Back to top
View user's profile Send private message
Linker



Joined: 06 Nov 2006
Posts: 29
Location: Almaty, Kazakhstan

PostPosted: Wed Jul 04, 2007 11:34 am    Post subject: Reply with quote

I've tried that DMD 2.0 final-const-invariant system, and it works just fine, though I've stumbled upon crash-bugs in compiler. Sad
So I'm doing as you described. Thanks. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Ray All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group