HNHacker News
TopNewBestAskShowJobs

xyheme

76 karma · joined June 21, 2020

https://xieyuheng.com
submissionscomments
xyheme··on Ash HN: What if we use file system as database?
directory tree is not as easy to view and edit as JSON.

One big JSON file is harder.

I am not fancy, and the aim is to simply use file system as database.

Not fancy stuff like "database as file system as database".

xyheme··on Ash HN: What if we use file system as database?
Me and a lot of linux user friends are using btrfs.
xyheme··on Ash HN: What if we use file system as database?
I should thought about that.
xyheme··on Ash HN: What if we use file system as database?
Isn't WinFS the reverse of "file system as database"?

Which is "database as file system".

xyheme··on Ash HN: What if we use file system as database?
That all can be achieved by using file system as database.

Not even complicated to implement.

See couchDB for how to handle "what if two people are editing a file at once".

xyheme··on Ash HN: What if we use file system as database?
JSON is there for human to read a record of data by group.

I think it is only good to use directory as data table to store JSON data files, but not for JSON data properties.

xyheme··on Ash HN: What if we use file system as database?
Inode limits depends on the file system you use.

I am using Btrfs.

Btrfs inode limits is in a whole different league (whereas ext4's inodes are allocated at filesystem creation time and cannot be resized after creation, typically at 1-2 million, with a hard limit of 4 billion, btrfs's inodes are dynamically allocated as needed, and the hard limit is 2^64, around 18.4 quintillion.

> -- https://unix.stackexchange.com/questions/18388/what-are-the-...

xyheme··on Ash HN: What if we use file system as database?
> The main reason is that I can use a variety of tools to view and manipulate files.

This is also the reason I am researching this old "What if" problem.

Because I think comparing to some version of MySQL or PostgreSQL, files are stable, open and timeless.

xyheme··on Ash HN: What if we use file system as database?
Thanks for the reminder about meaningful pathnames :)
xyheme··on Ash HN: What if we use file system as database?
Thanks for the link.

I read it, and I think it describes bad ways of using file system, but there are also good ways.

Just like there are bad ways of using SQL databases, and there are also NoSQL, and bad ways of using NoSQL databases.

xyheme··on Ash HN: What if we use file system as database?
So that I can use subdirectory to model "has many" relationship, like "a user has many projects".
xyheme··on Ash HN: What if we use file system as database?
I think, unless column-oriented database is used, "one file per row" is similar to normal row-oriented database.

Maybe there are some benchmarks in the past.

xyheme··on Ash HN: What if we use file system as database?
Why not use one JSON file as one record of data, and use pathname as primary ID?
xyheme··on Ash HN: What if we use file system as database?
@jqpabc123

I agree.

We (developers) should also design tools to address the need of small scale web apps.

Maybe, we do not even need some general tools to use file system as database, just speak this method more often.

xyheme··on Show HN: Deploying subdomain-based routing like github.io
Thanks, I now learn double content s have this effect on SEO :)
xyheme··on Show HN: Deploying subdomain-based routing like github.io
Hi, it's you again :)

My aim is to build a open-source mini vercel and netlify alternative.

`x-server` is just a starting point.

I have even more "evil" projects, like "using file system as database", I will leave that for another Show HN :) :) :)

xyheme··on Show HN: Deploying subdomain-based routing like github.io
I enjoy the criticism, I think I can learn things from them.

So far, feedback here are helpful to me.

Sorry about the mis-deleting.

xyheme··on Show HN: Deploying subdomain-based routing like github.io
Sorry about that, I was migrating my websites and repo out of vercel (to use this tool), during which I deleted a lot of outdated github repos.

I thinks I accidently deleted this repo.

Now it is back: https://github.com/xieyuheng/x-server

xyheme··on Show HN: iNet – A programming language for interaction nets
> ... when it comes to node rearranges, which, frankly, I didn't quite get.

I removed the syntax of rearrange, and added a new builtin `@spread`, I hope it is less confusing now :)

xyheme··on Show HN: A website server for serving many websites by subdomain-based routing
Caddy looks very complicated.
xyheme··on Show HN: iNet – A programming language for interaction nets
At that time, feel free to open issue at: https://github.com/cicada-lang/inet/issues

I will not miss an issue there :)

xyheme··on Show HN: iNet – A programming language for interaction nets
If you use telegram, welcome to join https://t.me/CicadaLanguage
xyheme··on Show HN: iNet – A programming language for interaction nets
If you use telegram, welcome to join https://t.me/CicadaLanguage
xyheme··on Show HN: iNet – A programming language for interaction nets
> About the game of life.

In the paper "Interaction Nets" ( https://github.com/cicada-lang/inet/blob/master/docs/referen... ), there is an example of 1-dimensional Cellular Automata. (Section 1.4. Example: Cellular Automata).

> About the stack-based layer of the language.

I have some concerns about it when deciding to use it, because it is so different from common programming languages. I am comfortable with postfix notation, because I am familiar with the Forth language ( https://en.wikipedia.org/wiki/Forth_(programming_language) ).

> About Rearrange.

I will improve the docs about it.

> About `closeAllFreePorts`

If `closeAllFreePorts` is the culprit, maybe it is because of my wrong implementation of the web frontend (not the language).

I should not call `closeAllFreePorts` in a loop.

see: https://github.com/cicada-lang/inet-website/blob/master/src/...

and: https://github.com/cicada-lang/inet-website/blob/master/src/...

It is a bug that I should fix.

I also implemented a command line program and a REPL: https://github.com/cicada-lang/inet#command-line-tool

Maybe a few thousand steps will not be slow there.

xyheme··on Show HN: iNet – A programming language for interaction nets
I plan to do multiple implementations of iNet too.

If you made an implementation, I will make a list of implementations in the homepage ( https://inet.run ), and add your implementation to the list :)

------

I do not know much about LLM yet, but I like hypergraphs too :)

(I learned about it from Wolfram Physics's docs.)

xyheme··on Show HN: iNet – A programming language for interaction nets
It feels really like Prolog, specially the `DiffList` example.

------

> They definitely both share the distinctions of principal ports v.s. auxiliary ports.

Version (1) and (2) both have principal ports v.s. auxiliary ports.

But only (1) has input ports v.s. output ports.

(I was actually quite shocked by this, when I read the 1997 paper.)

xyheme··on Show HN: iNet – A programming language for interaction nets
Thanks for the info.

My current plan is to programming with interaction nets directly, and to view Lamping's "optimal lambda calculus reduction" as an example.

I have not read Lamping's paper yet. But if it uses "Interaction Combinators", maybe I can not even do it in my implementation.

Because there are two version of inet:

(1) Lafont's 1990 paper "Interaction Nets"

(2) Lafont's 1997 paper "Interaction Combinators"

I implemented (1) where a port has a sign (input port v.s. output port). Given two ports, I can only connect them when they have opposite signs.

In (2) there is no input port v.s. output port, ports are not signed (Lafont called the signed version "directed" in (2)).

"Interaction Combinators" uses self interaction (rule about a node interacting with itself), it is not possible in signed version of inet.

Because one node only has one principle port, thus can not connect to it's own principle port, because the same principle port has the same sign, not opposite signs.

------

I said "programming with interaction nets directly", because it seems already a more practical language than lambda calculus, for we do not need lambda encoding to express datatype and pattern matching, we can define rules case by case directly.

xyheme··on Show HN: iNet – A programming language for interaction nets
Thanks everybody, your feedback and replys make me feel less lonely, I really appreciate it.
xyheme··on Show HN: iNet – A programming language for interaction nets
Thanks for your reply :)

It makes me want to learn more about quantum computing.

The foundational paper about interaction nets is published in 1990. (https://github.com/cicada-lang/inet/blob/master/docs/referen...) There must be some interesting developments during these 30 more years, maybe some of the developments are related to quantum computing ~

I am also somewhat naive minded, although I implemented this language, I actually only read the first 1990 paper about interaction nets, there are many follow up papers by the original author Lafont, some papers are about combinators, some papers are about linear logic and proof theory background of inet.

I will keep learning.

xyheme··on Show HN: iNet – A programming language for interaction nets
Thanks for your example!

I think I have just caught the first user of this little language :)

It is amazing that you can understand the language simply by my minimal amount of docs, and write this non-trivial example.

I will study your example and add it to the repository.

Your implementation of `Bin` reminds me of the implementation of binary number in minikanren ( http://minikanren.org ), in a book called "The Reasoned Schemer".

Self-hoist will be a very very interesting challenge!

(1) Maybe we can do it by firstly implement a low level graph processing VM, and compile it to the byte-code of the VM.

(2) How about self-interpreting? like lisp's meta-circular evaluator. Maybe this is even more challenging then compiling.

Either way, We will need some built-in primitive functions about IO, and also some primitive functions about string processing (to parse the syntax).

Maybe we can keep the core pure, and extend the lower layer stack-based language.

Should we do this in this JavaScript/TypeScript implementation? or to do this in a C/C++/Rust/Zig implementation? (the later seems have more potential to be practical)

Page 1 of 2Next →