Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Myrddin: a systems language that is powerful and fun (eigenstate.org)
73 points by rspivak on Jan 22, 2016 | hide | past | favorite | 66 comments


Author here. If you've got any questions, I'd be happy to answer.

I'm a little sad that this got posted before I had a chance to write a good tutorial and upgrade the documentation. So, imagine that this project was just about to step into the shower when Hacker News came knocking on the front door. "A package? I like packages but.. damn it. I'm not presentable yet."

All the code in compiled binaries is in Myrddin, other than a few assembly stubs: There is no dependency on any installed library, although you can bind to C if you want -- for example, http://git.eigenstate.org/ori/cbind-example.git/tree/

But everything else is in Myrddin. For example, memory allocations: https://github.com/oridb/mc/blob/master/lib/std/alloc.myr

Or regexes: https://github.com/oridb/mc/tree/master/lib/regex

The various system calls are all here: https://github.com/oridb/mc/tree/master/lib/sys

And so on.

If you want to play with it, there's a playground here: http://eigenstate.org/myrddin/playground

And there's even a neat little regex debugger it ships with that I find useful:

    $ redump '[a-z]+'
    abc123
    Match failed:
    	abc123
    	~~~^


"Are you tired of your compiler Just Working? Are you tired of having your standard library having the basic functionality you need? Do you long for the days when men were men, and debuggers operated on the assembly level? If so, Myrddin is for you."

That was awesome. Either you're delivering a refreshing amount of honesty or like to under-promise then over-deliver like me. ;)


It’s a paraphrase of Linus Torvalds’ announcement of Linux in 1991: https://groups.google.com/forum/#!msg/comp.os.minix/4995SivO...


"Why? Hurd will be out in a year"

Funny thing about that....


...is that I could still include the statement in a release of my own. And then you could. And another could.

I might have a RISC-V laptop before they finish Hurd. It still won't even run on RISC-V.


Didn't know about that. Funny shit.


Ori delivers refreshing honesty and over delivers, no or needed ;).


Lol I like that!


Have you used the D programming language at all? http://dlang.org/

If so, does myrddin have any benefits (current or planned)?


Funny you should ask. The project I'm on at work is written in D, and actually had Andrei working on it at one point.

The two languages are very different. D feels very much like an attempt to resolve the warts of C++ and extend its strengths, and it does a good job of that. If you like C++, you'll probably like D, although in many ways I feel that it has an immature implementation. (That's a rant for a different time, and it's not like Myrddin is more mature.)

Myrddin is going in a different direction, I think. It's far simpler than D. The best example of this is probably generics, where in D, they're seen as an opportunity to do complex metaprogramming on types, and idiomatic D uses generics. In Myrddin, they mean that your function is not allowed to care at all about types.

If you like both C and the ML family of languages, I think there's a good chance you'll like Myrddin.


Every new language suffers the same problem in its docs. The docs will show you:

* Hello world (yay, printing to console, wow!)

* How to declare functions (impressive.... most impressive </s>)

* Their type system (cool, you have ints, bools, floats... I'm drooling over here!)

Please folks, for your language's own good, please put the unique distinguishing features FIRST in your docs. I don't care what your printf looks like! Just show me the 3 things I can do in your lang that I can't do anywhere else, and then you might actually hook me into trying it out.


I think the Main features could be shifted above status.

But I would like to point out the first example shows type inference, arrays/slices that know their own size, and tuples, all of which are very interesting in a language that is otherwise the same as C. Perhaps it can be made more obvious though.


Couldn't agree more. Even worse are GitHub READMEs that usually go on and on about how to download, compile, install and run the compiler (how about making it so simple you could do it in 2 lines?!) and how to contribute code, without actually explaining what makes the language different.


I would argue that, for many users, manually installing software leads to a greater understanding of that software.

Take Linux/Bash as an example. What better way to learn Linux than to agonize over a Linux From Scratch installation, building CUPS, and successfully printing a test page to your printer?


I don't see how installing a compiler would improve your understanding of the language the compiler is for. If anything, it would improve your understanding of whatever installing software (bash, makefiles, etc.).


Yeah but you already WANT to install Linux. This here language is fighting for my attention. It's not gonna win it by showing me Hello World.


I agree, and I've been thinking of replacing what I have with a better sample program. The problem is finding a small example.

I mean, sure, I could post the code for my memory allocator, which showcases lower level raw memory manipulation, or a the formatting code, which showcases runtime type information, or some of the traits for iterables, but all of these take some time to digest, especially without first reading an introduction to the language.

What kind of example would you like?


Actually the "Hello ..." program is not so bad to show first. After all, it is a tradition, and like other introductions in the social universe, greetings serve a purpose. "Hello world" instantly tells me, ah, "this language is a lot like C with some interesting differences".

From there quickly getting into the features that make the language unique will prevent reader boredom. Overall your site was nicely done. One aspect I particularly liked is that you described all of the syntax in the examples. I really dislike when a new language is presented without making clear what symbols mean, as if I would just automatically know.

It will be interesting to see how Myrddin comes along.


The designer has a stange aesthetics for those {} (function body) and ;; (block terminator), is there a FAQ?

Update: This may be the best answer... http://eigenstate.org/myrddin/lang-checklist


It makes closures relatively clean, since the syntax is usable directly as an initializer for constants.

    var f = {arg
        body
    }

    const main = {
         g({arg; body})
    }


Yay! I have an irrational love of this sort of thing; I enjoy the reinforcement of the idea that functions are just another kind of value.

It seems like there really aren't that many languages with this symmetry (most lisps, JS/CS, Haskell, ...?), which I find a little strange.


So a semicolon plays three roles in the code (arg; statement; block;;), and it seems that ;; has higher precedence when ;;; is seen.


Sort of.

Endlines have one role: They end statements, although there are potentially many kinds of statement that they end.

';' and '\n' are alternative equivalent renderings of line endings. ';;' ends blocks. And yes, the lexer does the usual longest prefix match.


Myrddin language has very similar ideology in syntax to ACPUL.

http://acpul.org/ (see api & samples, also screenshots with minimal working code for DOTA game prototype)

But ACPUL is different, main idea in minimal touch programming on mobiles with full livecoding using self-development tools. Not only language. For example, editor & debugger is used and developed in real-time (also as other parts). By this, ACPUL syntax is very limited. It don't have strings, because strings is form of data. ACPUL don't have standart console log, because your console is whole GPU-accleated screen. And many others things.

I think Myrddin in right way, but additional tools is needed. I like it!


The compiler on github https://github.com/oridb/mc.


Is it memory-safe?


No. It is memory dangerous. Please use appropriate personal protective equipment when using this, or you may find you have lost all memory of your family.

More seriously: no, it makes no guarantees, but it tends to a much safer style by default: Bounds are checked, raw pointer arithmetic is ugly, clunky, and rarely used (although useful within, eg, the memory allocator), implicit conversions are gone, and null pointers aren't present in either the language or the library. You can define your own, even in a generic manner, but nothing uses this ability. Uninitialized variables are generally a compile time error (barring some bugs in the data flow analsyis), and so on. You can poke holes in the type system, but these holes are explicit.

As a result, most code written is going to be far safer than, say, C.


From paragraph 3, emphasis mine:

> Myrddin is not a language designed to explore the forefront of type theory or compiler technology. It is not a language that is focused on guaranteeing perfect safety. It is satisfied to be a practical, small, fairly well defined, and easy to understand language for code that needs to be close to the hardware.

Memory safety is also absent from the 'Major features' list.


it has bounds checking, everything uses slices, and you rarely need to use pointers so it is far safer than C, but not perfectly safe.


Dentist: Is it memory-safe?

Hoffman: Is what memory-safe?

Dentist: Is it memory-safe?

Hoffman: I don't know what you mean. I can't tell you something's memory-safe or not, unless I know specifically what you're talking about.

Dentist: Is it memory-safe?

Hoffman: Tell me what the "it" refers to.

Dentist: Is it memory-safe?

Hoffman: Yes, it's memory-safe, it's very memory-safe, it's so memory-safe you wouldn't believe it.

Dentist: Is it memory-safe?

Hoffman: No. It's not memory-safe, it's... very dangerous, be careful.

http://www.artvehicle.com/content/asides/AV-37-1228768613.jp...


>Just show me the 3 things I can do in your lang that I can't do anywhere else

You won't find such a new language. Most languages in use are already known to be Turing-complete. There is no new computation that "can't [be done] anywhere else [, except in some new language]".

It would be highly useful to give examples of things that are easier to do in your new language though.


We detached this subthread from https://news.ycombinator.com/item?id=10954802 and marked it off-topic.


I guess you can't be bothered to provide your reasoning of how this is not on-topic?

Might as well just delete it.

Edit: How do I become a moderator here? Also, who is "we"? You and who else?



Ah. Royal we. Nice.

Downmod bot has got me in its sights.


There are multiple moderators, so no, that is not an example of the "royal we".


Where can I see the list of user downmods?

Also, does this mean Dan does not run all of HN? Or do the sub-moderators just fluff?


What's a "user downmod"?


A user downmod is when someone pushes the "upside down triangle" next to a person's name and/or point score for a particular post, or, in some other way decrements a person's "karma".


Charming!


?

Edit: Know where I can find the feed of user downmods?


Theres no list of either "upmods" or "downmods". Think about the frequency that feed would be updated.


Karma is just mutable state with no backing event log?

Edit: I would also settle for a live stream of events; don't need the full history, if it doesn't exist.


What other people upvote or downvote on HN is really none of your business.


That's an opinion, I suppose.

When downmods serve to censor my content, they become my business. I don't know where you pulled 'upvote' from, though; I'm not sure there is much value in knowing them.

Edit: Someone is getting a feed of something...or they are just furiously refreshing this thread. hehe


Lots of downmods and zero answers in this thread. Classy.


Go would show channels. Rust would show the prevention of a memory ownership bug. Elm would show reactivity. Haskell would show that a monad is just a monoid in the category of endofunctors. what's the problem?

If you haven't got something interesting and at least unusual to show off very early in your docs, it's something to think about in your language design.

Now, you may have to build up a bit, and I'd certainly say you shouldn't bend your entire language around the "one cool demo", but I do think your early docs should make a hard burn towards whatever it is that sets your language apart. It's just basic sales.

(Elsewhere in this thread ori_b says this was not an intentional release, so I mean this as general advice, not targeted at this case. I don't know how to prevent too-early linking on social media sites short of not releasing anything public, which has its own problems!)


If you are replicating work, you are replicating work.

I try to avoid replicating work.


Anonymous downmods? Ok...

If your language only has features from some other language, you are replicating work.


It's not about computational power; this should have been obvious and not needing of clarification.

Unless of course you're trying to argue that the difference between python and javascript, for instance, is what each is capable of computing?


Python and Javascript should be able to compute exactly the same things (assuming an appropriate compiler/runtime and infinite time & space): any computable function.


Exactly. And yet they are profoundly different. That's my point. Obviously the things you can do in JS that you can't do in Python, or vice versa, have nothing to do with computation, so your original comment here is kind of pointless.


Which non-computational things can you do in JS and Python can you not do in the other and vice versa? I believe my machine can only do computations.


aerovistae is talking about the abstractions provided by the language. Yes, all Turing-complete languages can all compute all computable functions. But not all languages structure those computations in the same way, or make the same things easy or hard.

For example, Python has the concept of a decorator: https://docs.python.org/2/glossary.html#term-decorator. You can achieve the same thing in a variety of ways in JavaScript, but Python makes the concept of "a function that wraps another function" a central abstractions by providing syntax directly for it.


Precisely. Likewise, in JavaScript I can pass complex anonymous functions (not just little lambdas) as function arguments. I cannot do this in Python.


aerovistae specifically talked about the computational ability of languages:

>Unless of course you're trying to argue that the difference between python and javascript, for instance, is what each is capable of computing?


In a discussion like this, it's best to assume that all parties understand the ramifications of Turing-completeness. The charitable interpretation is that aerovistae meant what I said - which is apparently the case.


I agree, however kzhahou made a claim that there could be a language that could do something another couldn't.

The discussion with aerovistae about computation came from their initial post:

>Unless of course you're trying to argue that the difference between python and javascript, for instance, is what each is capable of computing?

If we are talking about ideal machines, there is no argument to be made that there is a difference between what the two named languages are capable of computing.


omg...

In real life I am very happy to have very extended conversations explaining things to people who don't get it, but on the internet, it's really just not worth it. I'm sorry you have misunderstood so much of this thread.


Maybe it is you who misunderstands? I see your point, but my point is different. If you can give me the specific words of mine that you believe show a misunderstanding, I could try to clarify.


Hi jsprogrammer, no one is making an argument about computability.

This is about how programmers can express themselves and reason about code. Not many people would choose to write their CMS in assembly.


Hi jsprogrammer.

You read my comment way too literally. I did not mean that a new language should have a feature that can literally not be done anywhere else. I meant: what are the uncommon features? What sets this language apart from the (dominant) other langs?

As someone else pointed out, in golang this would be goroutines or channels or golang's approach to composition vs inheritance. You can certainly implement those in another language, but they're not first-class features in most other langs. Put together, those elements give golang it's characteristic flavor.

For this new lang, I'm interested in learning (as early in the docs as possible) what sets it apart from C, C++, golang, python, ruby, JS, haskell, erlang, D, etc. The hello world example teaches the reader something, but it's not the thing a person first landing on that page probably cares about.

And going back to my original statement, there's lots of things that are still missing from programming langs and associated ecosystems. Just look at JS, and how even today people are still furiously trying to extend it and work around it just to build simple reactive websites.


kzhahou, sorry for reading you way to literally. I actually only have the words that you post :)

I think the important thing is to find the new things, but to realize that they aren't really new, just different ways of using the old. All of the languages you listed are really just specialized, assembly, or other, programs. Yes, most of the hard work has been automated away, but it's still there.

I like JS because it can be extended (though it can be very difficult to keep track of). I think there was a workaround phase when the VMs/interpreters/machines were slower, but pretty much everything can be compiled to JS these days. You don't even need to do that though, as JS embeds first class functions, so pretty much anything is within easy reach.


> You won't find such a new language. Most languages in use are already known to be Turing-complete.

I beg to differ: http://tkatchev.bitbucket.org/tab/

(Sorry for the shameless self-promotion, but you're wrong that nothing new can be invented.)


That (tab) looks pretty cool. I didn't say that nothing new can be invented though, only that you won't find a new language that can compute a function that no other existing language can.


A charitable interpretation of the sentence you quoted is your ending sentence.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: