8 ms·
Myrddin: a systems language that is powerful and fun
- cousin_it 11y agoIs it memory-safe?
- portmanteaufu 11y agoFrom 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.
- kzhahou 11y agoDentist: 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.jpg http://www.artvehicle.com/content/asides/AV-37-1228768613.jp...
- andrewchambers 11y agoit has bounds checking, everything uses slices, and you rarely need to use pointers so it is far safer than C, but not perfectly safe.
- ori_b 11y agoNo. 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.
- voaie 11y agoThe 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 11y agoIt makes closures relatively clean, since the syntax is usable directly as an initializer for constants. var f = {arg body } const main = { g({arg; body}) }
- akavi 11y agoYay! 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.
- voaie 11y agoSo a semicolon plays three roles in the code (arg; statement; block;;), and it seems that ;; has higher precedence when ;;; is seen.
- ori_b 11y agoSort 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.
- kzhahou 11y agoEvery 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 11y agoCouldn'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 11y agoI 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 11y agoYeah 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 11y agoI 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?
- ori_b 11y agoAuthor 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 ~~~^
- deleted 11y ago[deleted]
- nickpsecurity 11y ago"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. ;)
- andrewchambers 11y agoOri delivers refreshing honesty and over delivers, no or needed ;).
- 11y ago
- jsprogrammer 11y ago>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.
- aerovistae 11y agoIt'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?
- jsprogrammer 11y agoPython and Javascript should be able to compute exactly the same things (assuming an appropriate compiler/runtime and infinite time & space): any computable function.
- aerovistae 11y agoExactly. 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.
- jsprogrammer 11y agoWhich 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.
- scott_s 11y agoaerovistae 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 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.
- andrewchambers 11y agoThe compiler on github https://github.com/oridb/mc https://github.com/oridb/mc.
- d08ble 11y agoMyrddin 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!