Abstract type: Difference between revisions

Content added Content deleted
Line 125: Line 125:
bound? !destack
bound? !destack
is-instance? !destack Closure</lang>
is-instance? !destack Closure</lang>

So if ever we find an object which conforms it can be tagged. Here's a 'traditional' class definition using the Object class:
<lang python>class XYZstack(Object)
def !init()
var !items ()
def !enstack(object)
setq !items (cons object !items)
def !destack()
var tmp (car !items)
setq !items (cdr !items)
tmp</lang>
Now we instantate a concrete object and validate that it conforms to the Abstract type:
<lang python>(XYZstack(!new)) : AbstractStack</lang>


=={{header|Haskell}}==
=={{header|Haskell}}==