Ask HN: How would you implement a programming language with native data access?

1 points by dennisy ↗ HN
I have never spent much time reading or learning the Wolfram stack - mainly because I have not really ran into it much on the internet, it does not to me seem overly popular.

However there is one concept within it that seems quite neat, and that is that the language or platform has native data access, for example `WordFrequencyData`[1].

The naive approach is just to connect this up to a DB of data, but I am interested if there are any other such open source example or some other neat abstractions when it comes to programming abstractions being connected directly to data.

[1]: https://reference.wolfram.com/language/ref/WordFrequencyData.html

7 comments

[ 3.5 ms ] story [ 29.6 ms ] thread
There is nothing magical about Wolfram. It's just a Lisp with different syntax and a whole lotta built-in functions.

Any language can have "native data access" by using an API, and that's what Wolfram is doing under the hood.

The best language/tool/method for any piece of software is usually the one that 1) provides the user interface you're after and 2) is in a language you're familiar and efficient with.

Hi! Thanks for the reply - and I sort of worried this was going to be the answer.

I understand that I can take any language and create a higher level version which will provide functions which can access some data source.

But I still wonder if there is something more to how one could "truly" intermingle logic and data - one example might be a language which is executed directly in the DB, just spit balling.

If a DB is truly a store of data, then any language interpretation is going to be done by a language interpreter/compiler and not by the functions that store and retrieve data. You could think of SQL as a language that operates "inside" a database (though I would prefer the term "against" a database). With any Lisp, like Wolfram, you are halfway there as the language mixes data and instructions on purpose.
Ahh ok, so you are saying Lisp is more specialised in this direction vs say Python to Java?

Sorry for the ignorance but I have never used Lisp.

Yes. In Lisp there is no difference between how code is stored and how data are stored. Both are available to the REPL (a command line interface) which does allow for a different style of "live" development.

Although Lisp is powerful and fun, it's of note that the inventor of Lisp quickly turned his back on the concept to invent Algol -- which is the basis of nearly all other modern languages that aren't Lisps. In practice, mixing code and data often turns out to make things worse.