Hi, after going through my code, I've noticed that I had forgotten to change the path to the pickle I was using to load the class and consequently, the older version I was using to create my instances didn't have the new method defined. Sorry for the trouble.
2012/6/14 Khadija EL MAHRSI <khadija.elmah...@gmail.com> > Yes I've noticed this and I've tried creating another method and called it > instead of init but got an error along the lines of method not defined even > though I made sure over and over that I wrote the method properly. However, > after seeing your reply, maybe I should take another look at my code, maybe > I missed something. > > > 2012/6/14 Jorge Marques Pelizzoni <jorge.pelizz...@gmail.com> > >> Khadija, >> >> You might have not noticed but there is no such thing as constructor >> methods proper in Oz. The language only requires that you should >> specify some method (with arguments) to be called upon creation of an >> object. That is the whole point of the second argument to New, and it >> can be virtually any method of your choice. So you can create as many >> constructors as you see fit. For example (please pardon my Oz. It's >> ages since I last wrote Oz programs): >> >> class C >> attr someattr >> meth init1 >> someattr := unit; >> end >> meth init2(V) >> someattr := {NewCell V} >> end >> meth get($) >> @someattr >> end >> end >> >> C1 = {New C init1} >> C2 = {New C init2(10)} >> >> EVEN: >> >> C3 = {New C get(_)} >> >> Cheers, >> >> Jorge. >> >> 2012/6/14 Khadija EL MAHRSI <khadija.elmah...@gmail.com>: >> > Hi, >> > what you said is close to what I meant: a way to create instances of a >> same >> > class that don't necessarily share the same number of passed arguments >> to >> > the init method (and eventually respond differently to the passed >> > arguments). >> > I've also thought about some of the solutions you've listed but to be >> honest >> > I thought it would be such a hassle when it could've been made alot >> easier >> > by allowing something close to multiple constructors where you could >> have >> > different initialization methods to call according to your need. >> > Thanks for the reply. I just wanted to make sure I had no other choice >> > before resorting to other solutions. >> >> _________________________________________________________________________________ >> mozart-users mailing list >> mozart-users@mozart-oz.org >> http://www.mozart-oz.org/mailman/listinfo/mozart-users >> > >
_________________________________________________________________________________ mozart-users mailing list mozart-users@mozart-oz.org http://www.mozart-oz.org/mailman/listinfo/mozart-users