Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: passing argument(s) to Mata constructors
From
[email protected]
To
[email protected]
Subject
Re: st: passing argument(s) to Mata constructors
Date
Wed, 27 Feb 2013 17:30:30 -0000
Phil Schumm wrote:
Thanks. Alternatively, you can use a factory function that takes
arguments, and returns a fresh instance of the class suitably
initialized (i.e., based on the arguments passed to it). That's what
I wound up doing in this case.
----------------------------------------------------------------------
Good that you could find a workaround for your situation. A simple
factory is handy, but it really doesn't give you what the ability of
a constructor to take arguments does. There are situations where a
simple factory can't serve as an alternative to passing arguments to
constructors, for example, try implementing a singleton design
pattern in Mata (not that typical Mata usage needs a singleton).
Joseph Coveney
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/