[racket] init and init-field
Technically,
(class object% (define x 1) (super-new))
is a class with a private field. But this is just a terminology distinction.
Robby
On Wed, Jan 9, 2013 at 3:37 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
> On 2013-01-09 14:20:27 -0500, Harry Spier wrote:
> > Can someone give me an example where its necessary (or even better) to
> > use "init" instead of "init-field"
>
> Fields are always public unless you use `define-local-member-name`, so
> if you don't want to expose your state you are better off with the
> internal definition (which is private). There may be other reasons too.
>
> Cheers,
> Asumu
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130109/6e310c1f/attachment.html>