Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Moor Book, v0.1 #378

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

The Moor Book, v0.1 #378

wants to merge 19 commits into from

Conversation

abesto
Copy link
Collaborator

@abesto abesto commented Jan 20, 2025

Tl;dr: https://abesto.github.io/moor/the-moo-programming-language/built-in-functions/manipulating-moo-values.html#function-tostr

  • Took the Stunt manual, formatted it into an mdBook (book/gen-from-stunt)
  • Did some formatting work, most notably:
    • Function signatures now look not horrible
    • Turned function headers into actual headers (instead of bold text), making them directly linkable (thanks mdBook)
  • Added MOO syntax highlighting (book/theme/moo-syntax-highlight.js)
  • Dropped some of the bigger sections documenting Stunt features not supported in Moor
  • Set up a GH Action to publish the book when changes to it are pushed to main

This should be all that's needed to allow work to start on the content for real.
N.B.: the Legal and Foreword sections need to be updated ASAP.

!!! Required repo setup !!!

For the workflow to work, the GitHub Pages settings of the repo need to be flipped from "Deploy from a branch" to "GitHub Actions" under Settings -> Pages.

References

abesto and others added 19 commits February 5, 2025 12:18
The implementation is heavily dependent on highlightjs. There are noises
about mdbook replacing highlightjs with something different; if/when
that happens, this will need to be ported.
Removed the old ToastStunt forward. Wrote my own.
First draft here.

Replace references to Toast with mooR. Tones down "virtual reality"
talk a bit. Explanatory note about mooR vs LambdaMOO.
Also removes some Toast-specific entries, adds context text, and
shuffles location in the SUMMARY.md
  * Remove WAIFs, bools, and anonymous objects (bools may come back)
  * Add flyweights
  * Update notes about maps since mooR maps are slightly different
  * Update notes about maximum integers and floats.
@anubi
Copy link

anubi commented Feb 10, 2025

It would be nice to also have some information about running moor in a guide like this too, server administration of it requires a little know-how :(
I was curious about this project, but it doesn't connect and I've made no modifications from master; not asking you to fix it, but basic troubleshooting tips in readme.md or a pretty "book" would be nice:

Attaching to moor-daemon, moor-telnet-host, moor-web-host
moor-telnet-host | 2025-02-10T01:59:49.504666Z INFO main rpc_async_client: crates/rpc/rpc-async-client/src/lib.rs:90: Registering host with daemon...
moor-daemon | 2025-02-10T01:59:49.923322Z INFO main moor_daemon: crates/daemon/src/main.rs:95: moor 0.9.0-alpha daemon starting. Using database at "development.db"
moor-daemon | 2025-02-10T01:59:49.924485Z INFO main moor_daemon: crates/daemon/src/main.rs:102: Opened database path="development.db"
moor-daemon | 2025-02-10T01:59:49.924505Z INFO main moor_daemon: crates/daemon/src/main.rs:107: Database already exists, skipping textdump import
moor-daemon | 2025-02-10T01:59:49.924911Z INFO main moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:106: Creating new RPC server; with 8 ZMQ IO threads...
moor-daemon | 2025-02-10T01:59:49.925645Z INFO main moor_daemon::connections_fjall: crates/daemon/src/connections_fjall.rs:72: Opening connections database at "connections.db"
moor-daemon | 2025-02-10T01:59:49.926341Z INFO main moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:119: Created connections list, with 1 initial known connections
moor-daemon | 2025-02-10T01:59:49.928566Z INFO main moor_daemon: crates/daemon/src/main.rs:188: Checkpointing enabled to textdump-out. Interval: 360s
moor-daemon | 2025-02-10T01:59:49.928664Z INFO moor-scheduler run: moor_kernel::tasks::suspension: crates/kernel/src/tasks/suspension.rs:111: Loaded suspended tasks from tasks database num_tasks=0
moor-daemon | 2025-02-10T01:59:49.928687Z INFO moor-scheduler run: moor_kernel::tasks::scheduler: crates/kernel/src/tasks/scheduler.rs:199: Starting scheduler loop
moor-daemon | 2025-02-10T01:59:49.928701Z INFO main moor_daemon: crates/daemon/src/main.rs:221: Daemon started. Listening for RPC events. rpc_endpoint="tcp://0.0.0.0:7899" events_endpoint="tcp://0.0.0.0:7898"
moor-daemon | 2025-02-10T01:59:49.928709Z INFO moor-scheduler run: moor_kernel::tasks::scheduler: crates/kernel/src/tasks/scheduler.rs:249: No server options object found; using defaults
moor-daemon | 2025-02-10T01:59:49.928878Z INFO moor-rpc moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:161: 0mq server listening on tcp://0.0.0.0:7899 with 8 IO threads
moor-daemon | 2025-02-10T01:59:49.928989Z INFO textdump-thread moor_kernel::tasks::scheduler: crates/kernel/src/tasks/scheduler.rs:1275: Textdump written. final_path="textdump-out/textdump-1739152789.moo-textdump"
moor-web-host | 2025-02-10T01:59:49.929942Z INFO main moor_web_host: crates/web-host/src/main.rs:385: Serving out of CWD "/moor"
moor-web-host | 2025-02-10T01:59:49.930656Z INFO main rpc_async_client: crates/rpc/rpc-async-client/src/lib.rs:90: Registering host with daemon...
moor-daemon | 2025-02-10T01:59:49.931523Z INFO moor-rpc moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:315: Host v4.public.dGNwybbPDOWv9ho3ac_epyXRBRTkAH1ry6R6-laSh-US_c6WEffjWrCTw19G1xP-tnfY28Kcoavz5LDO0FhkmlkdAQ.a2V5LWlkOm1vb3JfaG9zdA registered with 0 listeners
moor-web-host | 2025-02-10T01:59:49.931697Z INFO main rpc_async_client: crates/rpc/rpc-async-client/src/lib.rs:101: Host token accepted by daemon.
moor-web-host | 2025-02-10T01:59:49.931863Z INFO tokio-runtime-worker moor_web_host: crates/web-host/src/main.rs:220: Listening on 0.0.0.0:8080
moor-web-host | 2025-02-10T01:59:49.992704Z INFO main moor_web_host: crates/web-host/src/main.rs:428: Bundle written to "./dist"
moor-daemon | 2025-02-10T01:59:50.525077Z INFO moor-rpc moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:315: Host v4.public.dGNwybbPDOWv9ho3ac_epyXRBRTkAH1ry6R6-laSh-US_c6WEffjWrCTw19G1xP-tnfY28Kcoavz5LDO0FhkmlkdAQ.a2V5LWlkOm1vb3JfaG9zdA registered with 1 listeners
moor-telnet-host | 2025-02-10T01:59:50.525354Z INFO main rpc_async_client: crates/rpc/rpc-async-client/src/lib.rs:101: Host token accepted by daemon.
moor-telnet-host | 2025-02-10T02:00:02.156939Z INFO tokio-runtime-worker moor_telnet_host::listen: crates/telnet-host/src/listen.rs:105: Accepted connection for listener addr=172.20.0.1:48874
moor-telnet-host | 2025-02-10T02:00:02.157005Z INFO tokio-runtime-worker moor_telnet_host::listen: crates/telnet-host/src/listen.rs:190: Accepted connection for listener peer_addr=172.20.0.1:48874 client_id=79476d17-d40b-4d9f-a652-024a31ef8c0f port=48874
moor-telnet-host | 2025-02-10T02:00:02.158026Z INFO tokio-runtime-worker moor_telnet_host::listen: crates/telnet-host/src/listen.rs:213: Connection established, connection ID: #-7
moor-telnet-host | 2025-02-10T02:00:02.158103Z INFO tokio-runtime-worker moor_telnet_host::listen: crates/telnet-host/src/listen.rs:243: Subscribed on pubsub events socket for 79476d17-d40b-4d9f-a652-024a31ef8c0f, socket addr tcp://moor-daemon:7898
moor-daemon | 2025-02-10T02:00:02.158302Z INFO moor-rpc moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:764: Performing Connected login for client: 79476d17-d40b-4d9f-a652-024a31ef8c0f, with args: []
moor-daemon | 2025-02-10T02:00:02.163430Z ERROR moor-rpc moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:807: Error waiting for login results error=TaskAbortedError
moor-web-host | 2025-02-10T02:00:15.836574Z INFO tokio-runtime-worker moor_web_host::host::web_host: crates/web-host/src/host/web_host.rs:222: Connection established, connection ID: #-8
moor-daemon | 2025-02-10T02:00:15.840012Z INFO moor-rpc moor_daemon::rpc_server: crates/daemon/src/rpc_server.rs:616: Detaching client client_id=307e554b-0db2-4d82-bf71-98325f9929ab

@rdaum
Copy link
Owner

rdaum commented Feb 10, 2025

@anubi server admin will definitely be a part of it. unfortunately this is a huge project, writing the documentation.

For your specific problem, it'd be easier to diagnose with more info if you want to join the Discord https://discord.gg/f5NnYJBfcG -- I don't see anything unusual in the logs, so I dunno what happened there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Portions adapted from the [Stunt Programmers Manual](https://lisdude.com/moo/ProgrammersManual.html) by Todd Sundsted Copyright © 2011, 2012, 2013, 2014 by Todd Sundsted.

Portions adapted from the [WAIF documentation](http://ben.com/MOO/waif.html) and [WAIF Programmers Manual](http://ben.com/MOO/waif-progman.html) by Ben Jackson.
Copyright @ 2025 by [Ryan Daum](http://github.com/rdaum) and [Zoltán Nagy](https://github.com/abesto)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aww


## Real Number Type
> Note: Many databases define the values $maxint and $minint. Core databases built for LambdaMOO or ToastStunt may not have values set which correspond to the correct (64-bit signed integer) maximum / minimum values for `mooR`.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add something like:

In general, the integer range supported by mooR tends to be at least as large as the integer range supported by other servers (definitely true for LambdaMOO and ToastStunt), so this shouldn't lead to any errors.


We will go into more detail on Anonymous Objects in the [Working with Anonymous Objects](#working-with-anonymous-objects) section.
mooR adds a new type called flyweights which are lightweight, garbage collected bundles of a delegate object, attributes ("slots") and arbitrary contents, and so combine features of objects, lists, and maps. Verb calls against flyweights dispatch against the delegate, and property lookups work gainst both the delegate and the flyweight's own set of slots.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/gainst/against/


You create and destroy OBJs explicitly with the builtins create() and recycle() (or allocate them from a pool using verbs in the core). They stay around no matter what you do until you destroy them.
flyweights are useful for representing large quantities of small, lightweight things (like a maze or a large quantity of small items).
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalize f?


All of the other types you use in MOO (that require allocated memory) are reference counted. However you create them, they stay around as long as you keep them in a property or a variable somewhere, and when they are no longer used, they silently disappear, and you can't get them back.
In particular, they have been especially structured to be able to mimic tree structured data like an HTML or XML document. There are builtins (`to_xml` and `xml_parse`) for converting properly structured flyweights to/from such documents.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My brain snagged on the first sentence. Here's an attempt to un-snag it:

The syntax is specifically designed to easily express tree structured data like an HTML or XML document.


OBJs grow by value_bytes(value) - value_bytes(0) for every property you set (that is, every property which becomes non-clear and takes on its own value distinct from the parent). LISTs and WAIFs both grow by value_bytes(value) for each new list element (in a LIST) or each property you set (in a WAIF). So a WAIF is never more than 4 bytes larger than a LIST which holds the same values, except WAIFs give each value a name (property name) but LISTs only give them numbers.
```
< $div_tag, [ class -> "background_div" ], { child_node_a, child_node_b } >
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we'll need to extend the highlight.js syntax highlighter for this block to look good :D


The value of a map can be any valid MOO type including another map.
> Note: mooR maps are built internally on a sorted vector, and searching within them is a BigO(Log(N)) operation. As they are immutable, and a copy must be made for modification, insertions and deletions are an BigO(n) operation.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that's surprising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants