~subsetpark/fugue

820d85632d982b28e44a94646988737cccfb2edf — Zach Smith 5 months ago 9c5ba78
Readme formatting
3 files changed, 27 insertions(+), 29 deletions(-)

M README.md
M fugue.janet
M project.janet
M README.md => README.md +10 -11
@@ 2,6 2,8 @@

An object system for Janet, inspired by CLOS.

---

The Janet language provides a simple form of object orientation using
tables and prototypes.



@@ 18,13 20,13 @@ Janet provides prototypal inheritance. Any table may have a prototype
set, whereupon any value access at that table that returns `nil` will
recurse upwards to the table's prototype.

## fugue
# fugue

`fugue` provides a more powerful set of commands that extend the
existing OO dynamics of Janet with a more elaborate interface and set
of features.

### `fugue/defproto`
## `fugue/defproto`

`defproto` is the main entrypoint to fugue, allowing users to define
*Prototypes*. These are Janet tables with some additional metadata


@@ 34,7 36,7 @@ allocation rules, ie, the configuration determining which object
fields should be populated at the instance level and which at the
prototype level.

### `fugue/defgeneric` / `fugue/defmethod`
## `fugue/defgeneric` / `fugue/defmethod`

`defgeneric` provides the interface for creating and managing *Generic
Functions*---functions which can be extended for additional


@@ 45,7 47,7 @@ prototypes can inherit methods from their ancestors. They can also
call ancestor methods by invoking `(prototype-method)` within their
own method bodies.

### `fugue/defmulti`
## `fugue/defmulti`

`defmulti` allows the creation of *Multimethods*. Unlike Generic
Functions/Single Methods, Multimethods can be defined for the types of


@@ 74,13 76,13 @@ Accepts two forms:
`(@ SomePrototype :some-field)` - Translates into `:some-field`, if
`some-field` is defined on `SomePrototype`.

`(@ SomePrototype some-object :some-field)` - Assets (as above) at
`(@ SomePrototype some-object :some-field)` - Asserts (as above) at
compile time that `some-field` is defined on `SomePrototype`; at
runtime, checks that `some-object` is a descendent of
`SomePrototype` and if so, translates to `(some-object
:some-field)`.

[1]: fugue.janet#L707
[1]: fugue.janet#L704

## Root



@@ 179,8 181,8 @@ Simple single-dispatch method definition. Roughly equivalent to

Defines a few symbols for reference in the body of the method.

`__parent` - Bound to the parent of `proto`.
`__super` - Bound to the method at `name` within `__parent`.
- `__parent` - Bound to the parent of `proto`.
- `__super` - Bound to the method at `name` within `__parent`.

[8]: fugue.janet#L353



@@ 461,9 463,6 @@ Anaphoric macro with transformed getter/setters.

Injects the arg `as` into scope as a reference to `obj`.

Any symbols that begin with `@` are transformed into `(<as> <field name>)`,
so that `@name` or its setter form `(set @name foo)` do the right thing.

See `with-slots` documentation for more details.

[18]: fugue.janet#L693

M fugue.janet => fugue.janet +3 -6
@@ 357,8 357,8 @@

  Defines a few symbols for reference in the body of the method.
  
  `__parent` - Bound to the parent of `proto`.
  `__super` - Bound to the method at `name` within `__parent`.
  - `__parent` - Bound to the parent of `proto`.
  - `__super` - Bound to the method at `name` within `__parent`.
  ```
  [name proto args & body]
  (upscope


@@ 696,9 696,6 @@

  Injects the arg `as` into scope as a reference to `obj`.

  Any symbols that begin with `@` are transformed into `(<as> <field name>)`,
  so that `@name` or its setter form `(set @name foo)` do the right thing.

  See `with-slots` documentation for more details.
  ```
  [proto obj as & body]


@@ 713,7 710,7 @@
  `(@ SomePrototype :some-field)` - Translates into `:some-field`, if
  `some-field` is defined on `SomePrototype`.

  `(@ SomePrototype some-object :some-field)` - Assets (as above) at
  `(@ SomePrototype some-object :some-field)` - Asserts (as above) at
  compile time that `some-field` is defined on `SomePrototype`; at
  runtime, checks that `some-object` is a descendent of
  `SomePrototype` and if so, translates to `(some-object

M project.janet => project.janet +14 -12
@@ 1,14 1,16 @@
(declare-project
  :name "fugue"
  :description "A CLOS-style object system based on Janet tables"
  :author "Z. D. Smith <zd@zdsmith.com>"
  :license "BSD3"
  :url "https://git.sr.ht/~subsetpark/fugue/"
  :repo "https://git.sr.ht/~subsetpark/fugue/"
  :dependencies ["https://github.com/pyrmont/testament"]
  :doc ```
 :name "fugue"
 :description "A CLOS-style object system based on Janet tables"
 :author "Z. D. Smith <zd@zdsmith.com>"
 :license "BSD3"
 :url "https://git.sr.ht/~subsetpark/fugue/"
 :repo "https://git.sr.ht/~subsetpark/fugue/"
 :dependencies ["https://github.com/pyrmont/testament"]
 :doc ```
An object system for Janet, inspired by CLOS.

---

The Janet language provides a simple form of object orientation using
tables and prototypes.



@@ 25,13 27,13 @@ Janet provides prototypal inheritance. Any table may have a prototype
set, whereupon any value access at that table that returns `nil` will
recurse upwards to the table's prototype.

## fugue
# fugue

`fugue` provides a more powerful set of commands that extend the
existing OO dynamics of Janet with a more elaborate interface and set
of features.

### `fugue/defproto`
## `fugue/defproto`

`defproto` is the main entrypoint to fugue, allowing users to define
*Prototypes*. These are Janet tables with some additional metadata


@@ 41,7 43,7 @@ allocation rules, ie, the configuration determining which object
fields should be populated at the instance level and which at the
prototype level.

### `fugue/defgeneric` / `fugue/defmethod`
## `fugue/defgeneric` / `fugue/defmethod`

`defgeneric` provides the interface for creating and managing *Generic
Functions*---functions which can be extended for additional


@@ 52,7 54,7 @@ prototypes can inherit methods from their ancestors. They can also
call ancestor methods by invoking `(prototype-method)` within their
own method bodies.

### `fugue/defmulti`
## `fugue/defmulti`

`defmulti` allows the creation of *Multimethods*. Unlike Generic
Functions/Single Methods, Multimethods can be defined for the types of