Chromatic <[EMAIL PROTECTED]> wrote:
> On Sun, 2004-04-04 at 10:17, Leopold Toetsch wrote:

>> .sub __init method

> I personally want to pass arguments to the initializer ("constructor"
> really isn't the right term).  I expect HLLs will want to do the same.

There isn't yet an official way to achieve this. But if you pass
arguments according to pdd03, the "__init" method get's it passed:

  .sub _main
      $P0 = newclass "A"
      $I0 = find_type "A"
      .local pmc obj
      $P1 = new PerlString
      $P1 = "a\n"
      $P2 = new PerlString
      $P2 = "b\n"
      P5 = $P1
      P6 = $P2
      obj = new $I0
      print "done\n"
      end
  .end

  .namespace ["A"]
  .sub __init method
      .param pmc one
      .param pmc two
      print "A init\n"
      print one
      print two
  .end

If you hide that hack in one place it should be easily changable.

> -- c

leo

Reply via email to