--- tags: hope --- # Hope IDE thoughts The goal is to have Hope doclets be programmable by non-programmers. A doclet should be easy to inspect. You should be able to add custom scripts or open a console to type live code. The environment should invite you to discover more. The IDE should be inspired by the Smalltalk environment. But unlike Smalltalk, it should only be about glueing doclets together to build a bigger whole. There is a limit to how small a doclet should be and that limit is bigger than a class or function in programming languages. The IDE in its first version needs to be simple and easy to build. Its main purpose is to investigate which direction to take. First goals: - Make the doclets and doclet API's discoverable - Allow custom scripts (javascript) to glue doclets together Each doclet must be inspectable. So we need some UI to select a doclet and ask about its API's. I'd like for this UI to be mainly keyboard focused. This also avoids conflicts in CSS from the doclets with the Hope IDE. So to inspect a Hope doclet, you open an inspector, either next to it or in a seperate window. This inspector is a REPL (Read Evaluate Print Loop). When it opens it starts with a list of doclets inside the current doclet (or host). You can select one of them or type its name and it will show the API's it supports. Select one of these and it will show the methods (messages) it has. You can start a new script by typing '.script [name]'. This will open a new tab with a code editor. You can list scripts by typing '.script'. To start a script in a specific doclet, type the name of the doclet and then '.script [name]', e.g.: ``` log.script example ``` You can start the javascript debugger in the normal way, through the browsers inspector or by inserting a `debugger` statement. You can also start a bus debugger: ``` log.debugger ``` This will open a tab which shows all the messages on the bus inside the `log` doclet. If a doclet name contains spaces or special characters, quote the name: ``` "a special doclet name".debugger ``` Tabs are shown when opened, but the REPL should remain visible below. The focus should probably remain in the REPL, but a `<tab>` should switch between the open tab and the REPL. You should be able to call API's in a doclet (or host) from the REPL, e.g. ``` log.api('/x/log/').write({message:"foo"}) ``` This should use autocomplete based on the reflect api. You should be able to add javascript code as well. The REPL should also have a history you can browse through using the cursor keys. This IDE is not meant as the main user interface to edit a doclet. Each doclet should build its own editing controls and UI. The Hope IDE is just a lowlevel inspector that is always there, just like the browsers inspector. The Hope IDE must be able to reload the main doclet. So it can't open in an iframe inside the doclet. If you edit a script in the main doclet, it might hook into the startup code of the doclet. Or it might change an existing API. The simplest way to make sure old code isn't called is to reload the main doclet. So for now the Hope IDE opens in a new window or tab. ``` .doclets log.doclets ``` This shows a list of doclets in the host, or inside another doclet. ``` log.foo.debugger ``` Starts a bus debugger for the doclet `foo` inside the doclet `log` (or if there is no such doclet it prints an error.) ## implementation details There is only one to drill down into child doclets: using the bus. So to support this, the IDE needs a bus API to create/read/update/delete scripts. The bus debug output is sent to the console, so we only need to be able to toggle the hope.bus.debug value of a child doclet through bus messages. To drill down more than one doclet, there needs to be a 'pass on' message and reply. ``` log.doclets ``` This must send a message to the log doclet asking for a list of doclets and their status. ``` log.script 'foo' ``` This must send a message to the log doclet, asking for its hope IDE to open a script named 'foo' in an editor tab. ``` log.debugger ``` This must send a message to the log doclet, asking to toggle the bus debug output.