Better HN
topnewbestaskshowjobs
Log inSign up

huahaiy

351 karma · joined Nov 7, 2011 (15y ago) · 221 submissions

I am a technologist, with an academic background in psychology and computer science.
Submissions

comment 1mo ago · link · parent

It happens very frequently if you happen to work on anything low level, e.g. a C code base, a database code base, etc. that deals with memory, and these have nothing to do with cyber security. It is extremely annoying and makes these models unusable.

comment 2mo ago · link · parent

81%is nothing. It is not hard to be more than 3x better than Postgres [1]. And you don’t need a model to do that, let alone a 4B model. How much additional compute is needed to just run that model?

[1] https://github.com/datalevin/datalevin/tree/master/benchmark...

3.

Datalevin 1.1.0: Top Performance Across Data Models(yyhh.org ↗)

1 points · by huahaiy · 2mo ago · discuss

comment 3mo ago · link · parent

Thank you for the interest and support.

comment 3mo ago · link · parent

Datalevin seems to fit the bill https://datalevin.org/docs

First paragraph of preface: “SQL has been the default language of application databases for half a century. That default is now holding application state back. Datalevin is a database built to replace SQL databases at the center of application systems: it stores data as small facts and queries those facts with Datalog”

comment 3mo ago · link · parent

Datalog exists and there are so many implementations.

comment 3mo ago · link · parent

Agree. Especially when Datalog queries are simpler to write and faster to run than SQL, there is a strong reason to at least try it.

comment 3mo ago · link · parent

Why not?

comment 3mo ago · link · parent

So this really is a NL to query translation problem. That exactly is why the target language matters. Simpler target languages makes AI’s work easier, as it saves tokens and context, so it is less likely for AI to make mistakes.

comment 3mo ago · link · parent

AI programming using English makes the database query language choice more important than before. Different languages require different context sizes. A better language is one requires less tokens and context.

comment 3mo ago · link · parent

I am the author of Datalevin, a Datalog database. In addition to using it in production personally, I am aware of other people using it. So, the answer is yes.

comment 3mo ago · link · parent

It is older than C. It is based on COBOL era idea of structured English as a computer language. There are better alternatives, e.g. Datalog.

comment 3mo ago · link · parent

Agree. Datalog could be a better alternative: https://datalevin.org/docs/preface

14.

AI Coding Has Erased the Supposed Advantage of Statically Typed Languages(yyhh.org ↗)

4 points · by huahaiy · 3mo ago · 2 comments

comment 3mo ago · link · parent

Doesn’t seem to work on code, where there is often little choices

comment 3mo ago · link · parent

Writing about Postgres internals and managing a Postgres cluster is the extent of your database expertise? You are not self aware enough to know that doesn’t earn any trust?

17.

Show HN: Datalevin – a simple, fast, and versatile Datalog database(github.com ↗)

8 points · by huahaiy · 4mo ago · discuss

comment 8mo ago · link · parent

I am glad you enjoyed it. I am happy to report that the next release will have many new features: Raft consensus based high availability (comes with an extensive Jepsen test suite); built-in MCP server; built-in llama.cpp for in DB embedding; JSON API; language bindings for Java, Python and Javascript.

comment 8mo ago · link · parent

I have been using AI to write Clojure code this past half year. The frontline LLM has no problem with writing idiomatic Clojure code. Both Codex and Claude Code fix their missing closing parentheses quickly. So I won't say "Writing Lisp is AI resistant". In fact, Clojure is a great fit with AI coding agent: it is token efficient, and the existing Clojure code used for training are mostly high quality code, as Clojure tends to attract experienced coders.

20.

SQLite in Production? Not So Fast for Complex Queries(yyhh.org ↗)

5 points · by huahaiy · 10mo ago · discuss

21.

Triple Store, Triple Progress: Datalevin Posited for the Future(yyhh.org ↗)

1 points · by huahaiy · 10mo ago · discuss

comment 10mo ago · link · parent

https://yyhh.org

comment 1y ago · link · parent

Wonderful. Looking forward to it.

comment 1y ago · link · parent

Very nice. Is there a plan to have an EDN writer in C as well?

comment 1y ago · link · parent

I wrote my library this way for both performance AND type checking reasons. You cannot tell me the reasons why I wrote my code my way. That is just absurd.

In any case, it is possible to write Clojure in a way that is type checked at compile time. And it is an acceptable way to write Clojure. I just want to clear the air.

comment 1y ago · link · parent

But if you add type hint in the signature, it does check the type. Basically, if you specify the type, it will check type. Just like any language that is not automatically inferring types, e.g. Java. So it is the same as Java.

You guys make it out like Clojure is doing something extra to hide Java types, but it doesn’t. What Clojure does is really minimal on top of Java. It barely hides anything.

If you give it type, it will check type. If you don’t give a type, it falls back to a default type, Object, which IS a TYPE. The fact that Clojure compiler cannot deal with GraalVM SVM Pointer type tells you that it’s checking type, because Pointer is not an Object! I found this out the hard way: https://yyhh.org/blog/2021/02/writing-c-code-in-javaclojure-...

“One limitation that one needs to be aware of when writing native image related Clojure code, is that most things in the GraalVM SDK inherit from org.graalvm.word.WordBase, not from java.lang.Object, which breaks the hidden assumption of a lot of Clojure constructs.”

comment 1y ago · link · parent

That has nothing to do with types. You are now talking about when a compiler is run.

Clojure gives you the option to run the compiler at runtime, so that's what people normally do. However, you can also run the compiler at compile time. Right?

For people who want type checking, they can opt to write Clojure in this defprotocol everywhere style, and turn on AOT. Then they basically get the same thing as what Java gives them.

As to example of libraries that are defprotocols everywhere, you should look at any of the low level performance minded libraries in the Clojure ecosystem, they are either written in this defprotocols everywhere style, such as nippy, neanderthal, dtype-next, and so on, or mostly in Java, such as http-kit, fast-edn, etc. I noticed this phenomenon, because my own libraries, editscript and datalevin, are written in this way. I take comfort that my fellow performance minded library authors are doing the same. Finally, isn't Clojurescript entirely driven by protocols?

So really, there are two kind of Clojure programmers. One type writes application code or high level libraries, and they write normal Clojure code all the time. However, there are also those who write primarily low level library code, which are used by the first camp, and their code is full of defprotocol and deftypes. So defprotocol everywhere is not anti-pattern. It's anti-pattern only in the mind of the first camp of programmers, and that's a narrow minded way of looking at things. Even the first version of Clojure Programming book by the core team members, are written in a way that's full of defrecord. Remember?

This "everything is a map" orthodoxy is turning people away from Clojure. Just let people write the code that suits their own needs. We can use more people who are pragmatic instead of dogmatic in the Clojure world. If you trust Rich Hickey's judgment, then you should trust him put in the features Clojure has for good reasons. Macros and protocols are part of the Clojure language, and you should be using them when the use case calls for them. Stop the "anti-pattern" nonsense.

comment 1y ago · link · parent

deftype IS a Java class, it's not compiled into something else. What is a Clojure function? A Clojure function is a Java class. Clojure is a compiled language, so it does check types, just like Java check types.

So if you use defprotocol and deftype for every domain objects in your code, your code won't compile if there's a type error. Try it.

BTW, that's the way many Clojure libraries are implemented. These libraries rely on dispatch on type to work, so they are taking advantage of the type checking.

Of course, you will say, "oh, clojure is not normally AOT, so it's not dong the checks.", but that's another issue. The issue at hand is this: can you write Clojure such that types are checked at compile time. The answer is YES.

The compiler may run only when you run the program, that's a different issue. You are confusing these two issues.

If you want a separate compile stage, then basically you are already excluding runtime compilation, i.e. you are arguing against runtime compilation. So it's not really about typing, but about how you want to run the program. Isn't it? You want AOT for everything, you don't want runtime compilation. That's it. It has nothing to do with types.

comment 1y ago · link · parent

Then you are not writing in defprotocol everywhere style. The keyword is everywhere. All the domain objects are deftype or defrecord. Try that. It is the same as Java, basically.

It is not an anti pattern, it is the way most low level libraries and clojure itself are written.

Clojure is a tool, not a cult. This core team worship is turning people away. The core team made plenty of mistakes, and got called out, rightfully.

12345
8