P
Patrick May
Patricia Shanahan said:Matlab is another exception.
As is Common Lisp.
Regards,
Patrick
Patricia Shanahan said:Matlab is another exception.
I have always felt that a if a method can have multiple inputs it
should be able to have multiple outputs, but very few language
designers (Forth and PostScript being exceptions) have agreed.
Roedy Green said:Places where multiple outputs would be useful:
1. 2D and 3D co-ordinates, Cartesian to polar.
2. returning a value with a status indicator about how good the value is.
4. division return quotient and remainder.
5. font/colour pair
6. find min, max average of a set.
3. categorising routines. Using a separate method for each
category must repeat the binning logic.
Places where multiple outputs would be useful:
1. 2D and 3D co-ordinates, Cartesian to polar.
2. returning a value with a status indicator about how good the value
is.
3. categorising routines. Using a separate method for each category
must repeat the binning logic.
4. division return quotient and remainder.
5. font/colour pair
6. find min, max average of a set.
Imagine a method that took the name of an animal and categorised it byI do not understand what this is, but never mind.
Yes, but actually I am not aware of a reason,
why not to encapsulate these compounds in a class.
The only argument I remember was »overhead«.
This breaks down to
- Notational overhead in the source code
- Execution time overhead
Patrick said:As is Common Lisp.
Michael said:- Garbage overhead.
This may turn out significant.
Imagine a method that took the name of an animal and categorised it by
size, colour, and country of origin.
Eric Sosman said:The only situation where it seemed useful was when an
expression produced a "primary" value and "ancillary"
information -- somewhat like the "value and trust level"
situation you mentioned earlier.
Individual values would have to be collected; there's virtually no difference
in collection of a container for those values.
Weigh against the bug risk induced by separation of variables that belong
together.
Michael said:No they don't. Imagine a method rerun passing values to a static result very often.
Even if not, the overhead for another object may be 1:2 (I.e. two ints
vs. two ints in a container.
You would not need to have them separated logically or on code basis, never
more than a line apart.
When did the result start having to be "static"? I understand neither what
you mean by the term in this context, nor how that influences GC overhead.
How are you getting this ratio?
The cost of garbage collection is proportionate to the number of live
objects, not to the number being collected.
Separated is separated. "Close" is only good for horseshoes.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.