Discussion:
[urbit] Code Review Requested: simple command line *sole browser for %clay filesystems.
Jeremy Wall
2015-08-15 01:39:02 UTC
Permalink
As part of my journey to learn %gall in urbit I've written a very simple
command line *sole browser for %clay filesystems.

https://bitbucket.org/zaphar/urbit-clay-browser

Still needs some user interface tweaks but it has three commands.

- go: to visit a new path
- show: to show the contents of a file in clay
- help: to show help

Just hitting enter on the prompt lists the current directory path contents.

Suggestions on better ways to do things are appreciated.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
***@marzhillstudios.com
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Curtis Yarvin
2015-08-15 11:12:24 UTC
Permalink
I think the main stylistic point I'd flag (eg in ++list-card) is that when
you use =+ to bind a face that's used only once, it's not the best
functional style. Hence instead of

=+ foo=3
=+ bar=4
=+ moo=5
~[foo bar moo]

it's preferable to write ~[3 4 5]. Or if your values are longer than 3, 4,
and 5:

:~ 3
4
5
==

It's sometimes the case that an unnecessary =+ makes the code better
looking and easier to read, but relatively rare. It's also worth getting
in the habit of coding in a canonical style even when, as here, your goal
is to try out features like %gall.

Similarly for variable names - conventionally, you are either doing TLV
because you have a small set of names, or long unabbreviated names. When I
see a name like "sess" I look for an arm, not a leg.

Also, semantically, for ++stop your ++abet is not quite right because it's
not deleting the subscription, as you note in the comment. Generally I'll
put in another resolver, like an ++abut, that deletes the session instead
of reinstalling it.
Post by Jeremy Wall
As part of my journey to learn %gall in urbit I've written a very simple
command line *sole browser for %clay filesystems.
https://bitbucket.org/zaphar/urbit-clay-browser
Still needs some user interface tweaks but it has three commands.
- go: to visit a new path
- show: to show the contents of a file in clay
- help: to show help
Just hitting enter on the prompt lists the current directory path contents.
Suggestions on better ways to do things are appreciated.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jeremy Wall
2015-08-15 15:57:37 UTC
Permalink
Post by Curtis Yarvin
I think the main stylistic point I'd flag (eg in ++list-card) is that when
you use =+ to bind a face that's used only once, it's not the best
functional style. Hence instead of
=+ foo=3
=+ bar=4
=+ moo=5
~[foo bar moo]
it's preferable to write ~[3 4 5]. Or if your values are longer than 3,
:~ 3
4
5
==
It's sometimes the case that an unnecessary =+ makes the code better
looking and easier to read, but relatively rare. It's also worth getting
in the habit of coding in a canonical style even when, as here, your goal
is to try out features like %gall.
Similarly for variable names - conventionally, you are either doing TLV
because you have a small set of names, or long unabbreviated names. When I
see a name like "sess" I look for an arm, not a leg.
Also, semantically, for ++stop your ++abet is not quite right because it's
not deleting the subscription, as you note in the comment. Generally I'll
put in another resolver, like an ++abut, that deletes the session instead
of reinstalling it.
What exactly semantically is pull supposed to return? I was very unclear on
that as the code shows.
Post by Curtis Yarvin
Post by Jeremy Wall
As part of my journey to learn %gall in urbit I've written a very simple
command line *sole browser for %clay filesystems.
https://bitbucket.org/zaphar/urbit-clay-browser
Still needs some user interface tweaks but it has three commands.
- go: to visit a new path
- show: to show the contents of a file in clay
- help: to show help
Just hitting enter on the prompt lists the current directory path contents.
Suggestions on better ways to do things are appreciated.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
***@marzhillstudios.com
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jeremy Wall
2015-08-15 16:01:56 UTC
Permalink
Post by Curtis Yarvin
I think the main stylistic point I'd flag (eg in ++list-card) is that when
you use =+ to bind a face that's used only once, it's not the best
functional style. Hence instead of
=+ foo=3
=+ bar=4
=+ moo=5
~[foo bar moo]
it's preferable to write ~[3 4 5]. Or if your values are longer than 3,
:~ 3
4
5
==
It's sometimes the case that an unnecessary =+ makes the code better
looking and easier to read, but relatively rare. It's also worth getting
in the habit of coding in a canonical style even when, as here, your goal
is to try out features like %gall.
Similarly for variable names - conventionally, you are either doing TLV
because you have a small set of names, or long unabbreviated names. When I
see a name like "sess" I look for an arm, not a leg.
Hoon naming conventions are very much a mystery to me. Are there any
general guidelines there?
Post by Curtis Yarvin
Also, semantically, for ++stop your ++abet is not quite right because it's
not deleting the subscription, as you note in the comment. Generally I'll
put in another resolver, like an ++abut, that deletes the session instead
of reinstalling it.
Post by Jeremy Wall
As part of my journey to learn %gall in urbit I've written a very simple
command line *sole browser for %clay filesystems.
https://bitbucket.org/zaphar/urbit-clay-browser
Still needs some user interface tweaks but it has three commands.
- go: to visit a new path
- show: to show the contents of a file in clay
- help: to show help
Just hitting enter on the prompt lists the current directory path contents.
Suggestions on better ways to do things are appreciated.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
***@marzhillstudios.com
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Curtis Yarvin
2015-08-15 18:15:17 UTC
Permalink
We should have a document for naming conventions and I think it's discussed
in some of the old Hoon tutorials. But this is followed in most of our
code:

For legs (variables), use one-letter variables starting with 'a' for really
small scopes, eg, |=(a=@ (mul a a)). For relatively simple and local
scopes, use a TLV, usually a random CVC string, sometimes with some vague
relationship to the value but usually not. For large and complex scopes,
use unabbreviated words with kebab-case.

For arms, generally a quasi-random 4-letter English string is the default.
Small scopes can use 3-letter, eg, ++add. For large and complex scopes,
unabbreviated words with kebab-case.
Post by Jeremy Wall
Post by Curtis Yarvin
I think the main stylistic point I'd flag (eg in ++list-card) is that
when you use =+ to bind a face that's used only once, it's not the best
functional style. Hence instead of
=+ foo=3
=+ bar=4
=+ moo=5
~[foo bar moo]
it's preferable to write ~[3 4 5]. Or if your values are longer than 3,
:~ 3
4
5
==
It's sometimes the case that an unnecessary =+ makes the code better
looking and easier to read, but relatively rare. It's also worth getting
in the habit of coding in a canonical style even when, as here, your goal
is to try out features like %gall.
Similarly for variable names - conventionally, you are either doing TLV
because you have a small set of names, or long unabbreviated names. When I
see a name like "sess" I look for an arm, not a leg.
Hoon naming conventions are very much a mystery to me. Are there any
general guidelines there?
Post by Curtis Yarvin
Also, semantically, for ++stop your ++abet is not quite right because
it's not deleting the subscription, as you note in the comment. Generally
I'll put in another resolver, like an ++abut, that deletes the session
instead of reinstalling it.
Post by Jeremy Wall
As part of my journey to learn %gall in urbit I've written a very simple
command line *sole browser for %clay filesystems.
https://bitbucket.org/zaphar/urbit-clay-browser
Still needs some user interface tweaks but it has three commands.
- go: to visit a new path
- show: to show the contents of a file in clay
- help: to show help
Just hitting enter on the prompt lists the current directory path contents.
Suggestions on better ways to do things are appreciated.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
--
You received this message because you are subscribed to the Google
Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Jeremy Wall
http://jeremy.marzhillstudios.com
--
You received this message because you are subscribed to the Google Groups "urbit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to urbit-dev+***@googlegroups.com.
To post to this group, send email to urbit-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...