From: Rick M. <obj...@gm...> - 2015-03-30 19:32:02
|
The arguments passed to the init() method depends on the implementation of the new method for the class. In the case of array, the new() method needs to use the arguments to construct the array instance before init() is called, so none of the arguments are passed along. Rick On Mon, Mar 30, 2015 at 9:12 AM, Erich Steinböck <eri...@gm... > wrote: > When subclassing .Array, I noticed that method init() wouldn't get access > to args that were supplied to the class new() method. Depending on the > class that is being subclassed I'm seeing different results. > > subArray~init 0 args -- all args are missing > subMB~init 8 args 1,2,3,4,5,6,7,8 -- last two args are missing > subString~init 9 args 2,3,4,5,6,7,8,9,10 -- first arg is missing > subDir~init 10 args 1,2,3,4,5,6,7,8,9,10 -- all args show up > subOC~init 10 args 1,2,3,4,5,6,7,8,9,10 > subStream~init 10 args 1,2,3,4,5,6,7,8,9,10 > subFile~init 10 args 1,2,3,4,5,6,7,8,9,10 > subObject~init 10 args 1,2,3,4,5,6,7,8,9,10 > > If this is working as designed: how can I get access to all args (e.g. in > the .Array-example)? > > > Here's the test code: > > .subArray~new(1,2,3,4,5,6,7,8,9,10) > .subMB~new(1,2,3,4,5,6,7,8,9,10) > .subString~new(1,2,3,4,5,6,7,8,9,10) > .subDir~new(1,2,3,4,5,6,7,8,9,10) > .subOC~new(1,2,3,4,5,6,7,8,9,10) > .subStream~new(1,2,3,4,5,6,7,8,9,10) > .subFile~new(1,2,3,4,5,6,7,8,9,10) > .subObject~new(1,2,3,4,5,6,7,8,9,10) > > ::class subArray subclass Array > ::method init > say 'subArray~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > ::class subMB subclass mutableBuffer > ::method init > say 'subMB~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > ::class subString subclass String > ::method init > say 'subString~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > ::class subDir subclass Directory > ::method init > say 'subDir~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > ::class subOC subclass orderedCollection > ::method init > say 'subOC~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > ::class subStream subclass Stream > ::method init > say 'subStream~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > ::class subFile subclass File > ::method init > say 'subFile~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > ::class subObject subclass Object > ::method init > say 'subObject~init' arg() 'args' arg(1, 'A')~makeString(, ',') > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Oorexx-devel mailing list > Oor...@li... > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > > |