GithubHelp home page GithubHelp logo

sanette / bogue-tutorials Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 0.0 6.46 MB

A collection of tutorials for the OCaml Bogue library

Home Page: https://sanette.github.io/bogue-tutorials/bogue-tutorials/index.html

License: Other

Makefile 9.08% Shell 11.77% OCaml 59.85% CSS 0.67% Standard ML 18.63%
bogue documentation gui ocaml-library tutorials

bogue-tutorials's People

Contributors

sanette avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bogue-tutorials's Issues

hello world: rooms, trees and widgets

Hi,

Looking through the hello world example, and pretending for a moment that I haven't yet read the docs or API for bogue, looking at just the contents of the tutorial a few questions would arise:

  • does a widget have a size, does a room have a size? Can a room have a padding around a widget?

Proposed solution: I found the explanation in the existing docs quite succint, perhaps part of this could be added to the hello tutorial?

Roughly speaking:
widget = content
layout = container

  • residents, rooms, houses. But the tutorial then talks of trees: is the nesting predefined and of fixed depth, or can we have arbitrary depth nesting (with some convenient names for the lower and upper levels?)

Proposed solution: at least according to the API the layouts can be nested arbitrarily deep, if the nesting was fixed depth I would've expected to see a non-recursive type instead: https://ocaml.org/p/bogue/latest/doc/Bogue/Layout/index.html#create-layouts-from-other-layouts.

This comment from the source code seems relevant:
https://github.com/sanette/bogue/blob/master/lib/b_layout.ml#L216-L223

I suggest a small modification to this part:

. Thus, an element of type Layout.t can either be:
a true "room" (containing a single resident), or
a "house" containing several rooms.
Side-note: we have here the usual construction for a tree data structure: each node is either terminal (and called a leaf, which for us are widgets), or a vertex (for us, a layout), pointing to a list of sub-nodes.
To summarize, in Bogue, the complete GUI is simply a tree of layouts, and the leaves contain a widget.
The trunk of the tree (our main house, if you wish), will correspond to the layout associated with the window of the GUI. In Bogue we often call this special layout the "top layout", or "top house". (Yes, this may sound weird: our tree grows top-down...)

I think a 3rd bullet point would clarify all this: "rooms can be arbitrarily nested"

  • finally I think the best way to explain the nesting and tree structure here would be visually (maybe not in the hello world example but the next one?): have a nested layout and show the boundaries of each with boxes (perhaps of different color) and have a legend showing which is the resident, room and board.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.