Closed Sarcasm closed 1 month ago
Love it! How would you do file permissions?
Also, you could come up with your own name. Building a tree language is cheap so could build a whole new one.
Happy to team up on a Twitch call and pair program one out.
I guess you could add the restriction to not allow spaces in filenames, then just do index.js Writeable
or something. Lots of options
For permission yes, I think it could be specified after the filename. Maybe a bad idea, but could be in a chmod-like format:
foo.py +x
#!/usr/bin/env python
print("hello world")
Maybe the presence of a shebang is enough to warrant the execution bit. And like now, other permissions could be omitted.
You know what I only use that execution bit once in a blue moon. This Stamp alternative could be dead simple (expands to plain vanilla non-executable files) without file permissions.
Just playing with the demo in the Designer I like yours better than mine.
It reminds me of a better https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html
Would you be interested in making your own repo and running with that idea?
I could contribute over there. I'd love to hear how much the experience currently sucks of building one's own Tree Language (my guess is very bad).
I think it would be worthwhile and would be a user myself.
I attempted something (link at the end). Not sure I will push it further but I was happy to give it a try.
Regarding my experience.
Some nice things:
Less nice things:
f
in the text editor produce something weird, the f
s get smaller / closer to each others (font ligature?).@Sarcasm finally got back to this. This is awesome!
I find it way better than Stamp. Feels natural. I made a few tiny changes to your code above (just changed execute methods to compile for consistency. The other reductions in code were just to temporarily make the link shorter). Named it "Clay". Playing around with it made me think of shaping a full project fluidly.
I want to go through your feedback and address the individual points, but just wanted to say this is awesome. Better than Stamp and really as simple as possible. Kudos.
Hello,
I just try the Clay example, and it looks like there is an issue with the package.json generated content:
Two reasons for this:
1) The core TreeNode methods are not great. Some methods I often make mistakes with, such as getLines. I think some subpar methods could removed, some can be better named, and some more helpful core methods could be added. Perhaps there should be fewer public methods, but the ones remaining should be fantastic and foolproof. Or maybe there's a missing pattern(s) that would make core easier to use. Not sure. All I know is that I wish the core API was better!
2) In this specific example, I changed the compilation of the parent file block to use childrenToString
instead of getLines. Given a Tree like:
a
b
c
d
Then "childrenToString" of "a" returns simply the text block:
b
c
d
I find this to be a very common pattern when embedding non-tree languages in a tree language and use it often. Using methods designed for tree languages inside "blob", non-tree language blocks can be tricky, and generally just dumping those blobs is what you want, in which case "childrenToString" works great. This situation should probably be well documented in future Grammar docs. The code currently parses non-Tree language blobs like this just like any other Tree Node, and I think there are some theoretical issues that could be resolved there. It's definitely one of the places that needs some good FAQs, as I was just having a long conversation with another dev on this very topic.
Just for clarity, a diff of the fix:
The fix makes sense, childrenToString()
looks more natural/correct than iterating over the lines, thank you.
I finally got around to this!
Right now the stamp language provides this syntax:
I'm wondering if it could not be simplified like this:
Directories can discriminated from files thanks to the final
/
. Children of directories are files. Children of files, is file content.Would that still qualify as a treenotation language?