> As the author of constructor

Yes, Yardanico already told us.

But from my current understanding your macro currently can initialize objects 
only with default constants. Which I need rarely as my defaults are generally 
binary zero. What I sometimes need is initialization with runtime values as in 
my example above:
    
    
    proc initialize(s: Step; prev, next, id: int) =
      s.prev = prev
      s.next = next
      s.id = id
      s.radius = 0 # default for incident net
      s.outer = false
    
    
    Run

Here Step is an object, and next, prev, id are runtime variables. Id is an 
integer, and next and prev may be references (I do not know the type, wrote the 
Ruby code ten years ago, but this detail does not really matter for the concept 
of initialization.)

The core idea of my initial post was that the parameter names of the runtime 
initializer proc exactly match the fieldnames of the object to initialize. And 
that is a pattern which often occurs for me, like student.firstName = 
firstName. With the std "with" macro we could write firstName = firstName which 
is still not really nice. I will investigate your macro, maybe I can tune it 
for my needs.

Reply via email to