Re: Ensuring a method exists




Pascal Costanza ha escrito:

[...]
What you don't have in CLOS is that you can force client software to
explicitly implement methods. It's left up to the responsibility of the
programmer to define the right methods, or to leave them out when they
are actually not necessary.

I understand. Thanks.

It's important to note that static typing doesn't really help you a lot,
either. One of the pro-static-typing arguments is that it require
programmers to at least think about their design and provide empty
methods in case they are not really needed, making that design decision
an explicit one. But for example in Java, such a method can still throw
an OperationNotSupportedException, divide by zero, or do other silly
things. "Modern" development environments like Eclipse even fill in such
methods automatically for you - go figure.

Yes, I'm used to.

So to summarize, a CLOS programmer mainly uses documentation to
advertise what a client program has to do to fulfill the needs of a
framework.

Or you can use more sophisticated MOP algorithms.

I understand that this is in this way because generic functions do not
belong to classes. That's why they invented :after and :before, it is
the only way to simulate virtual functions in some way.

.



Relevant Pages

  • Re: Retired programmer wants to learn programming
    ... where the "code that is not explicit" is, ... What do you see as the difference apart from the target language? ... you of the value of higher-order function since I suspect you have seen ... assert that you fall into the category of programmer I characterised. ...
    (comp.programming)
  • Re: Retired programmer wants to learn programming
    ... higher-order functions. ... assert that you fall into the category of programmer I characterised. ... you find yourself evangelising about languages that are rarely used to ... 'Explicit' does not mean 'can be deduced from'. ...
    (comp.programming)
  • Re: C-programmer needs Forth advice
    ... But at least it was explicit on which variables were used. ... The only reason why I can see someone might want "this" to be explicit is because they haven't settled on a convention in the code. ... I chose a convention that was distinct but not easily confused; your macro has parenthesis and a comma, and that can get quite confusing in the kind of expressions originally in adapt2.c. ... this doesn't bother you because it's a convention that is part of Forth that is designed to make your life easier as a programmer. ...
    (comp.lang.forth)
  • Re: Standards interpretation: interface and intent?
    ... >> Usually though if something is passed, that makes it explicit. ... >> application programmer didn't provide it, ... It's explicit to the compiler. ... Liberty is a well armed sheep contesting the vote. ...
    (comp.lang.fortran)