EnfranchisedMindMain Page | About | Help | FAQ | Special pages | Log in


Printable version | Disclaimers | Privacy policy

Ashlar Types

From EnfranchisedMind


There are two kinds of types in Ashlar: concrete and abstract. Functional style code is accomplished with concrete types. Objective style code is accomplished with abstract types. Concrete types are those thing you instantiate, and by referring to an abstract type, you can read its data and generally muck about with it. Abstract types, on the other hand, are type signatures: they can be instantiated by implementing inline (akin to Java's anonymous interface implementations), but are generally used as a way of expressing available calls.

A concrete type implements an abstract type if, for each function signature in the abstract type, a function is provided implementing the signature with the concrete type. A function is provided by being in scope at the calling point (an implicit conversion takes place at this point).

For foo of concrete type Bash, the syntax foo.bar() is equivalent to Bash.bar(foo). For abstract types, foo.bar() attempts to resolve against the abstract type implementation. In both cases, if an appropriate method cannot be found, then we revert to resolving against bar(foo).

Retrieved from "http://enfranchisedmind.com/wiki/page/Ashlar_Types"

This page has been accessed 806 times. This page was last modified on 10 December 2010, at 18:41. Content is available under Attribution-Share Alike 3.0 Unported.


Find

Browse
Main page
Community portal
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
New section
Printable version
Context
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list
Statistics
More...