Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: passing argument(s) to Mata constructors

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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index