
Myrddin: a systems language that is powerful and fun - rspivak
http://eigenstate.org/myrddin/
======
ori_b
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/](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](https://github.com/oridb/mc/blob/master/lib/std/alloc.myr)

Or regexes:
[https://github.com/oridb/mc/tree/master/lib/regex](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](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](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
        	~~~^

~~~
nickpsecurity
"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. ;)

~~~
teddyh
It’s a paraphrase of Linus Torvalds’ announcement of Linux in 1991:
[https://groups.google.com/forum/#!msg/comp.os.minix/4995SivO...](https://groups.google.com/forum/#!msg/comp.os.minix/4995SivOl9o/GwqLJlPSlCEJ)

~~~
improv32
"Why? Hurd will be out in a year"

Funny thing about that....

~~~
nickpsecurity
...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.

------
kzhahou
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.

~~~
tomp
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.

~~~
AndrewUnmuted
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?

~~~
kzhahou
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.

~~~
ori_b
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?

~~~
jrapdx3
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.

------
voaie
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](http://eigenstate.org/myrddin/lang-checklist)

~~~
ori_b
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})
        }

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

~~~
ori_b
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.

------
d08ble
Myrddin language has very similar ideology in syntax to ACPUL.

[http://acpul.org/](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!

------
andrewchambers
The compiler on github
[https://github.com/oridb/mc](https://github.com/oridb/mc).

------
cousin_it
Is it memory-safe?

~~~
ori_b
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.

------
jsprogrammer
>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.

~~~
dang
We detached this subthread from
[https://news.ycombinator.com/item?id=10954802](https://news.ycombinator.com/item?id=10954802)
and marked it off-topic.

~~~
jsprogrammer
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?

~~~
tptacek
FWIW: Dan runs HN, all of it.

[https://blog.ycombinator.com/two-hn-
announcements](https://blog.ycombinator.com/two-hn-announcements)

~~~
jsprogrammer
Ah. Royal we. Nice.

Downmod bot has got me in its sights.

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

~~~
jsprogrammer
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?

~~~
tptacek
What's a "user downmod"?

~~~
jsprogrammer
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".

~~~
tptacek
Charming!

~~~
jsprogrammer
?

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

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

~~~
jsprogrammer
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.

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

~~~
jsprogrammer
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

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

