Re: Two 'Output questions



"Alex R. Mosteo" <devnull@xxxxxxxxxxxxxx> wrote in message
news:42C43B48.1040802@xxxxxxxxxxxxxxxxx
> Hello everybody,
>
> a) Is there any guarantee that 'Output is implemented like...?
>
> 1. Write bounds/Tag
> 2. Call to 'Write

No, because it might be inherited (untagged types only) or redefined. But if
it is not, the default implementation is described by 13.13.2(25-27), and it
says the same as the above.

> I see that the containers provided with gnat gap 2005 have 'write
> redefined but not 'output. While I don't see reasons to use 'output on
> definite types (?), I'm guessing gnat does so because of a). I don't see
> any explanation in the RM, so if I'm right it may be still
> gnat-dependent. I suppose it's handy too to not have to redefine both
> 'Output and 'Write when the latter is enough.

Like I said, see 13.13.2(25-27).

> b) Is there any way to call the default 'Output attribute once you have
> redefined it? The reason for this is that I have a variant record in
> which just one of the variations needs special treatment... I have ideas
> for workarounds but I'm now just curious.

If the type is derived, you can call the operation of the parent type in the
obvious way. You might be able to rename the original operation before the
redefinition (the "squirreling away" type of rename, which certainly works
for overriding). But otherwise it is gone.

Randy.



.



Relevant Pages

  • Two Output questions
    ... I see that the containers provided with gnat gap 2005 have 'write redefined but not 'output. ... While I don't see reasons to use 'output on definite types, I'm guessing gnat does so because of a). ... I suppose it's handy too to not have to redefine both 'Output and 'Write when the latter is enough. ...
    (comp.lang.ada)
  • Re: Is Final for classes and methods a good feature or something that should be eliminated?
    ... need to redefine this method in subclasses". ... I think its downsides cost more than its benefits help. ... So what are some good reasons for it: ... If you can not redefine methods in a subclass, ...
    (comp.object)
  • Re: prevent overloading of procedures
    ... As no namespaces are used and I can't do anything else but begging users ... not to redefine existing procedures (which doesn't work for obvious ... reasons) I think Ulrich's hint will do it. ...
    (comp.lang.tcl)
  • Re: Q: How to catch stdout in tcl
    ... it afterwards (see code snip, ... To redefine the puts command with rename is not enough -- ...
    (comp.lang.tcl)
  • Q: feature adaption order
    ... only after "rename" and "export", AFAICS. ... -- Georg. ...
    (comp.lang.eiffel)