15 ms·
Raku: A language for gremlins
- munificent 3y agoOne way you might arranging programming languages in a 2D space is with two axes: 1. How much should the language surprise you? 2. When the language does surprise you, should it delight you or horrify you? surprising ^ | | | delight <------+------> horrify | | | v unsurprising Only a sadist would deliberately design a language for the top right quadrant, but there are many esoteric languages in there. I think most people tacitly assume that all well-behaved languages belong on the bottom left: the language should rarely suprise you but in the rare case it does, hopefully it's a delight. Raku seems to overtly aim for the mostly-unoccupied top left. It's like the designers and users (two sets with apparently very large overlap) all think, "Yes, it's weird. Isn't that grand!"
- actionfromafar 3y agoI'm very interested in bottom right langs.
- netr0ute 3y agoC++!
- Qworg 3y agoOnly old C++, new C++ creeps up the y axis.
- actionfromafar 3y agoInteresting perspective. It surprises you in exactly how, but not very in that it will. (Horrify you. But it also delights sometimes. We need more dimensions?)
- aldanor 3y agoTo put it differently, the new C++ is delightfully horrific at times.
- ModernMech 3y agoC++ occupies a region of the space rather than a singular point, since old C++ is part of new C++.
- baq 3y agoI’d say C++ fills the space. It can be as dumb or as clever as you want it. It’s horrifying in a third dimension.
- munificent 3y agoMaybe C?
- actionfromafar 3y agoYou can definitely get there with C but the language isn’t actively pushing you into horror.
- segfaultbuserr 3y agoIt's the "unsurprising" part in "unsurprising & horrifying" - if you manipulate raw pointers incorrectly, of course it will crash or be vulnerable, to the surprise of no one by design.
- actionfromafar 3y agoThis rings true the more I think about it. Any large code base gets there with size, but with C one gets there pretty reliably after a certain heft of code.
- segfaultbuserr 3y agoThat being said, while C's surprises are certainly fewer than other languages, it still does have a few surprising corner cases in contrary to its usual "portable assembly" character (without compiler optimization) - implicit type promotion in expressions with mixed data types, potential malloc() in printf(), possibility of Duff's device, and the likes. A Sun engineer Peter van der Linden has a book Expert C Programming, Deep C Secrets that explores these topics.
- munificent 3y agoIt doesn't actively push you there, which is why it's on the bottom half. There is a fairly coherent mental model for C and once you have it, the language rarely surprises you. But when it does surprise you, it's almost never anything good. Stuff like Duff's device, `3[someArray] = value`, etc. The surprises are always the language's raw machinery showing through in unpleasant ways, and never a delightful bonus feature the designers added for you.
- deleted 3y ago[deleted]
- zukzuk 3y agoAbsolutely JavaScript, in that it is easy to accidentally do horrifying things, but absolutely not surprising if you’ve spent any time working with it, as you quickly get used to how awful it is.
- baq 3y agoI’ve been in some sort of web development since 2005 and am to this day surprised by just how much awful is packed in there. Most is deprecated - thank God and any other deities - but it’s still there lurking for newbies and unaware developers coming from sane languages.
- giancarlostoro 3y agoHave you seen how people can write JavaScript within CSS yet? That's another fun one. :)
- jonathrg 3y agoLanguages where there has been significant modernization and progress, but where codebases and online resources lag behind: CMake, PHP, CSS
- actionfromafar 3y agoNothing can redeem CMake and CSS in my eyes. To me they fit perfectly in the bottom right, unsurprising horror. PHP is often just bland drudge, true horror in PHP land is unexpected when I encounter it.
- the_af 3y agoCOBOL?
- pravus 3y agoI think my vote goes to ColdFusion.
- grotorea 3y agoIt's just the languages everyone knows are bad.
- aidenn0 3y agoAssembly on load-store machines? (with perhaps the omission of MIPS where the lack of instruction interlocking can cause surprising things).
- orthoxerox 3y agoJava 4, Java 6, maybe even Java 8.
- eddd-ddde 3y agoI found about raku one time I had an assignment for college where I needed to create a parser. I found raku's grammar features really interesting and used it for my project, it felt almost like cheating since it did pretty much every thing for me (actually it was probably just cheating but it was still fun).
- db48x 3y agoThat’s exactly what you want in a language. It should always feel like cheating! Also debuggers. Give RR a try some time :)
- eddd-ddde 3y agoI imagine you are referring to https://rr-project.org/ https://rr-project.org/ ? Had never heard of it, looks pretty amazing, I might actually enjoy debugging now!
- fuzztester 3y agoLow contrast text site. I know there are workarounds, but we shouldn't need them.
- celrod 3y agoEvery time I try it, it doesn't seem to work right. Because I don't feel like debugging my debugger, I just go back to gdb. Yet I only hear other people speaking of it positively, so it seems they don't have that experience.
- toast0 3y agoThe problem is those are subjective axes. And things can both delight and horrify; I wrote some javascript once where I did document.write = function ... which is kind of delightful in that I was able to do what I needed as a result, but also pretty horrifying :) Other people I showed it to felt it was more on the horrifying side, but like I said, it's subjective.
- shagie 3y agoThen a 3d chart with "likelihood of" being a point or region in the space. The axises would then be "Surprise", "Delight", and "Horrify".
- dkarl 3y agoContext is critical. Unless you're a beginner with the language, surprise in a production codebase is horrifying. The Perl philosophy has never been compatible with lack of surprise. Perl wants to be like natural language, and natural language has limitless surprises. The problem with Perl (or, I assume, Raku) in production is that the responsible way to read it is like reading every single footnote in an annotated edition of Shakespeare. It sucks the joy out of it, and joy is the point. Production Perl is joyless and therefore pointless, unless you're some kind of prodigy who understands every obscure political reference and every 16th century pun without any help.
- Dylan16807 3y ago> Context is critical. Unless you're a beginner with the language, surprise in a production codebase is horrifying. Why? Are you assuming a very particular kind of surprise here? "Oh, I can replace these five lines with a single builtin." is a surprise, and so is seeing that someone else already did so.
- silisili 3y agoI was thinking axes of 'readability' and 'expressiveness' would make a nice chart for programming languages.
- flir 3y ago> You check set membership with ∈ Yeah, ok, I see what you mean. >> 0,2,4...10 > (0 2 4 6 8 10) >> 1,2,4...10 > (1 2 4 8) Wait... what? Is it looking the next number up in OEIS or something?
- anthk 3y agoDamn, that made me laugh.
- kragen 3y agoUnable to deduce arithmetic or geometric sequence from: 1,2,5 Did you really mean '..'?
- flir 3y ago> arithmetic or geometric See, that doesn't delight me. OEIS is what's needed here.
- hwayne 3y agoWelp now I know what "using it in anger" is gonna look like
- deleted 3y ago[deleted]
- nerdponx 3y agoMaybe there's some way to extend the compiler to use OEIS. Is there a "liboeis" that lets you download and interact with the OEIS database offline?
- anthk 3y agoThere's must be one or two for either Python or Perl. Well: https://github.com/sidneycadot/oeis https://github.com/sidneycadot/oeis
- 3y ago
- Kwpolska 3y agoIn my view, Raku was venturing further and further into the top-right corner with every subsequent paragraph.
- cogman10 3y agoI mean, it was "Perl 6" so is it really surprising that Perl devs wanted a language that looks nothing like any other language? Perl has it's own healthy share of "delightful surprises" and Raku was mostly designed to eliminate perl's horrifying surprises.
- throwanem 3y agoApparently by replacing them with new horrifying surprises, if this article is any indication. Good grief, I don't miss working in Perl.
- cogman10 3y agoOne person's unspeakable horror is another's creature comfort.
- fuzztester 3y agoDe gustibus ...
- fuzztester 3y ago>Good grief, I don't miss working in Perl. Good and grief in the same sentence about the same language ... Perl. Delighted and horrified? ;-)
- throwanem 3y agoDelighted that the screwing around I did in high school from a copy of the Camel Book my mom got me for my birthday gave me a skill I could parlay into a job that turned into a great career. Horrified once I finally got out into the industry proper and discovered all I'd been missing. It's not that I regret ever having worked in Perl. It's just that I'm glad to have moved on to bigger and better things.
- steelframe 3y ago
- deleted 3y ago[deleted]
- kbenson 3y agoThe issue I have with the language is that I went from the top left of that graph to fairly far on the right, vacillating between the top or bottom. That happened for me long before it became Raku. I clearly remember reading through the synopsis and exegesis documents around fifteen years ago and being excited for what was to come, but I also remember the first bits that gave me pause. Like unspace[1]. I also clearly remember when it started dawning on me that Perl 6 (as it was still called at the time) would never see any real adoption by people that were interested in other people working with them on things, whether that be some open source project or at a company with coworkers. It was when I was reading through the advent calendar exercises for some year and realized that while I couldn't recall half the features used to solve the problems, I had been exposed to them all multiple times before. The reason I couldn't remember them was because there were so many ways to solve the problems, that it felt like just keeping up with the features and syntax was overwhelming, and that unless you used a very strict subset of the language, it would be near impossible to limit the effort requires to understand what you read from others, or even yourself some time previously. To many detractors of Perl, this won't be an unfamiliar complaint, but I've always felt that while Perl (5) projects could easily devolve into a mess if some care wasn't taken, it wasn't that hard to exercise some restraint and still take advantage of the extra capabilities when more power was needed. Put another way, while there was definitely more than one way to do it, it didn't feel like there were tens of vastly different ways of doing it that might have been sourced from random inclusions anywhere in the codebase because of numerous ways to insert entry points into every block, leaving you scratching your head when you encountered odd behavior. Now, it's not a problem for a language to want to reside squarely in the "this is for screwing around and trying any feature you can imagine and how they interact together", but that's not necessarily great when you are trying to accomplish something with someone else and you need to have a shared base of understanding to work from. The real problem is that many, many people in the Perl6/Raku community obviously really hoped for it to take over for Perl 5 or at least be useful for projects which might have multiple people working on them, whether they be through github or for some commercial work entity with coworkers, so they could spread its use and have a reason to use it on a regular basis. I think once it became clear that it wouldn't serve that purpose as well, many people lost interest. I know that was the case for me. I was an avid lurker on the project for well over a decade, but eventually I just couldn't convince myself it was a good idea to use the language for anything other than small test programs to satisfy my own curiosity, and eventually not even there, since if I didn't already have it installed the overhead for a small test was quite high. In the end I guess Raku found its niche, and it's doing okay where it is (I assume, I've fallen so out of date I'm not sure), but it's sad that it seems they had to shed a lot of their original community (as someone who identifies as part of their original community) to do so, whether that's through any concerted effort on their own part or not. That is, I don't think Raku changed to be what it is, I think most people eventually realized what the bundle of features that was originally proposed really means in reality, and realized it didn't fit what they actually wanted. 1: https://design.raku.org/S02.html#Unspaces https://design.raku.org/S02.html#Unspaces
- Tao3300 3y agoI like to think Ruby is dead center, by virtue of the fact that sometimes I'm not sure if I'm delighted or horrified. https://codegolf.stackexchange.com/a/33217 https://codegolf.stackexchange.com/a/33217
- rendaw 3y agoWhy would you choose anything on the right, surprising or otherwise?
- penteract 3y agoWhen the consequences of trying to be accommodating in as many ways as possible force you into a horrifying conclusion that rarely appears in practice. Turing complete type systems are an example that could be seen this way.
- deleted 3y ago[deleted]
- EgregiousCube 3y agoHoon is occupying that top-left quandrant as well, as long as you you don't mistake your surprise for horror - https://developers.urbit.org/guides/core/hoon-school https://developers.urbit.org/guides/core/hoon-school . Surprisingly powerful.
- bonkler59 3y agoHoon is in the top right quadrant when you begin to understand the performance characteristics and what it would take to improve them. And the type system is pitiful.
- tazjin 3y agoIt's what you get when a programming language is designed to support a political philosophy, and not a technical one ;)
- zogrodea 3y agoThank you for your effort with the ASCII art. Must have taken some time.
- mochaki 3y ago[dead]
- DontchaKnowit 3y agoPedantry incoming- one of my greatest pet peeves is when some words in a list, or diagram, are in their adjectival form and some are in their verbal form. "Surprising" + "horrify" It really unnerves me. The worst is that nearly every company has this in some form in their promotional or educational materials. E.g. here at Genericorp, we prioritize the following valurs : integrity, kindness, honest, Etc You get my point. Drives me nuts this kind of thing constantly slips through the cracks.
- Joker_vD 3y agoWell, the axiis are orthogonal. One of them is for the thing's quality, another is for the thing's action, so you get adjectives along one axis, and verbs along the other.
- DontchaKnowit 3y agoYeah thats fair. Not a great example. Still irked me tho.
- ezrast 3y agoThe grammatical term for this is - perhaps surprisingly, for this crowd - "parallelism".
- Tao3300 3y agoIts impotent to halve clear valurs.
- giancarlostoro 3y agoIs this measurement on the entire language or specific features? Because if its on the entire thing, I can see the results not being good (all over the different quadrants). I do agree though, that if a language surprises me, it should be to the left quadrant in this case. If a language is not surprising me, it should be delight as well. I don't know if I call people who made / use Brainfuck sadists as much as I'd call them very geeky / nerdy.
- eternityforest 3y agoRaku looks very horrifying if you want to actually do anything practical. But that's some incredibly clever stuff! I wouldn't want to use it, for like, anything, but if there was a programming based game or code golf contest or something it would probably be a great choice. And the original article talks about math, and I have no real experience actually doing nontrivial math IRL, so perhaps it has some useful properties for people who do.
- melezhik 3y ago> Raku looks very horrifying if you want to actually do anything practical. Why so? Raku is practical, I have a solid experience of doing a lot of practical things with it. It has all battery included things - type checking, overloading, named/typed function parameters, oop, functional programming - what else you need? Python seems awkward for me in comparison with Raku with all that features ...
- chungy 3y agoIt's worth remembering that Raku originated as "Perl 6" and a lot of design philosophies are derived from Perlisms in the first place. The author seems to be unfamiliar with both Perl and Raku's history, given that he immediately comments on the x operator for repeating strings. Which has been the case for many decades of Perl. :)
- gunapologist99 3y agoFTA: "The regex syntax isn't backwards compatible with Perl 5. For thirty years languages followed the PCRE "standard" and Perl 6 just… threw it all away." so it looks like the author has at least passing familiarity.
- hardburn 3y agoWhich also gives away some gaps in the author's knowledge. Perl wasn't following the PCRE standard. It was the PCRE standard. Everything else was following it. Usually with some piece missing--far more implementations should have the /x modifier. The Perl 6 design process didn't throw it away after 30 years. It threw it away with less than 10 years. There was already widespread knowledge that Perl had gone beyond "regular expressions", and IIRC, that was even before it had implemented recursive expressions. Perl 6 would be "patterns", and they would be good enough to be used as a full grammar. The language itself could be parsed in it, and Raku sometimes is, depending on the implementation.
- gunapologist99 3y ago> It was the PCRE standard haha true > The language itself could be parsed in it, and Raku sometimes is, depending on the implementation. That's fantastic, didn't realize.
- afiori 3y ago> For thirty years languages followed the PCRE "standard" It says that (most) other languages followed the standard set by Perl 5, not that Perl followed the PCRE standard
- no_wizard 3y agoRaku is interesting as a language indeed. I can't get over some of the idioms, they just don't map nicely in my head. The same reason AppleScript struck me as weird, it trys to use natural language on one hand (e.g. `my`, `say`, `sub`, `gather`) with some oddities like `@` being used for (assuming?) scoped iterations or declaring modules[0] and some other from-an-outsider byzantine syntax decisions. For instance, I can logic this out, mostly, but it would not feel intuitive to me to "discover": ``` my @bottles = (flat ((99...2) X~ ' bottles'), '1 bottle', 'no more bottles', '99 bottles'); my @actions = (flat 'Take one down and pass it around' xx 99, 'Go to the store and buy some more'); for flat @bottles Z @actions Z @bottles[1..*] { say "$^a of beer on the wall, $^a of beer. $^b, $^c of beer on the wall.\n".tc; } ``` These idioms don't click for me intuitively. Its a very symbol heavy language and the symbols often appear to be overloaded by context. All to say, its okay! different languages isn't a bad thing, however I can't say that I'd use Raku even if it was the best fit for something, like say, a natural language parser (which based on all evidence Perl / Raku is really good at building parsers) [0]: https://examples.raku.org/categories/module-management/Fletcher.html https://examples.raku.org/categories/module-management/Fletc...
- BaseballPhysics 3y agoLet me guess, you were never a Perl programmer? Trust me, if you have a Perl background, a lot of that syntax looks pretty familiar (the @ sigil in particular denotes an array).
- no_wizard 3y agoYes. Though that's my point, to me it doesn't feel the most welcoming to others who know another language (or languages). By all means though, if folks like it, carry on. I am sure Raku as a runtime is well engineered, I respect that. I don't know what lineage Raku shares other than Perl, but it seems to be on its own plane if you will, and thats cool.
- deleted 3y ago[deleted]
- frou_dh 3y agoWhen I was looking at the language, I didn't find the documentation "really poor". In fact I was impressed at how much of a one-stop-shop the official docs site was for both conceptual docs and API docs. https://docs.raku.org/ https://docs.raku.org/ Look at the following page as a jumping off point for conceptual stuff. Absolutely top class: https://docs.raku.org/language https://docs.raku.org/language
- legends2k 3y agoThat's due to the Perl culture. Their FAQs and man pages were top class due to the kind of programmers who write Perl; funny, pithy and quirky.
- layer8 3y agoThe Perl man pages were always excellent.
- fuzztester 3y agoYes. I remember downloading them, as multiple PDF files, one for each broad subsection (like perlsub, perlvar, etc.) under the main TOC or so, over a somewhat slow Internet cafe connection and then reading many of them. Not only excellent content, but excellent typography and design too, even though they were mainly text. I remember, even now, thinking that the PDFs looked really good.
- fuzztester 3y ago>Look at the following page as a jumping off point for conceptual stuff. Absolutely top class: >https://docs.raku.org/language https://docs.raku.org/language Thanks for that.
- landyacht 3y agoAs someone who has been doing Raku for several years now, I will say the documentation is both great and also lacking. Most of what's there is well written and includes useful example code, but I occasionally run across things that either haven't been documented at all or have only been documented for simple cases. The worst offender in my experience is the module system. There are docs around it, but they would benefit from a rewrite with a less "technical" audience in mind. The module/package distinction is difficult to wrap your head around just from reading the Modules page. The fact that the declared namespace of what you import can be different from the namespace you used to import, but the directory structure has to match the namespace for the compiler to find it... it's useful and makes sense in a strange way, but I had to learn that by fiddling around. # in Name/Space/Thing.rakumod unit class Thing { … } # in UseCode.rakumod use Name::Space::Thing; my Thing $thing .= new: …;
- devit 3y agoIt's just Perl 6 renamed.
- zem 3y agopyret has kebab-case and infix subtraction too, but it has an easy time doing so because it made the decision that infix operators have to be surrounded by whitespace. i guess that wouldn't really be in keeping with raku's anything-goes philosophy though.
- cjm42 3y agoLet's face it, the Perl 5/PCRE regex syntax is atrocious. The only reason it exists is that (? was a syntax error in earlier regex syntaxes, so it could be redefined to mean anything. Raku is an attempt to design a sane regular expression language from first principles, now that we know what we want them to be able to express. The alternative is being stuck with (?:this|(?>or that)) for the next 30 years.
- justinator 3y ago>Let's face it, the Perl 5/PCRE regex syntax is atrocious. Agreed, but god-damn is it useful.
- db48x 3y agoRaku’s new grammar syntax is much less awful and just as amazingly useful.
- justinator 3y agoThat's cool that's cool, but the problem is getting people to use Raku.
- db48x 3y agoOr even just Raku’s grammars. Perhaps we need an RCRE library :)
- lizmat 3y agoPerhaps. But that will become very difficult indeed. Because in Raku, grammars are just a different way to write code. Grammars are really just specialized classes. And tokens / rules / regexes are just specialized methods. It all compiles down to bytecode, rather than something you can feed a statemachine. This has several advantages: if a grammar doesn't provide functionality you need, you can write it in Raku code as part of the grammar. It also means that when you improve execution of the bytecode, you will also improve the performance of grammars and regexes. Finally: Raku grammars are very powerful. They are used to parse the Raku language itself. Which is a testament to its power. But also brings a whole set of challenges for the core developers :-)
- Joker_vD 3y agoI sometimes idly wondered what would a programming language look like if it were filled to the brims with syntactic sugar. Now I know. It has this "it's horrifying but in a weirdly enticing kind of way, I can't make myself look away, show me more, please" kind of feeling.
- justinator 3y agoWait until you learn about Raku's Grammars.
- jasmataz 3y agoYou might like noulith, a hobby language written by the person who won several of the recent Advent of Code events. The about on GitHub reads "slaps roof of [programming language]* this bad boy can fit so much [syntax sugar] into it." They even used the language in the most recent event Advent of Code and won. https://github.com/betaveros/noulith https://github.com/betaveros/noulith
- BaseballPhysics 3y agoI have the same reaction every time I look at modern C++.
- pie_flavor 3y agoMy favorite feature of Raku: Integer division and decimal literals both return `Rat`, a rational fraction type. Even though everyone knows floats suck, nobody is actually moving away from them except Raku. If you want a float literal you specifically have to use scientific notation.
- moonchild 3y agoIt's actually an awful misfeature, because those Rats will automatically turn into floats when the rational representation gets too big: > WHAT 1/10 (Rat) > WHAT 1/100000000000000000000 (Num) (There is FatRat, which does not so 'promote', but it is not the default.)
- cosmojg 3y agoHa, it's like best-effort typing. The interpreter gives you a precise rational if it can, and it throws you a float if it can't. I suppose that, in a language as dynamic as Raku, the idea is that you should never need to keep track of types anyhow, but this might be nicer if this value ends up being your user-facing output, depending on the application.
- moonchild 3y agoThere is no reason why it could not continue to use the exact representation and operations if it wished (and that's what FatRat does). It's just an ill-conceived concession to performance.
- librasteve 3y agoand yet, raku is the first serious attempt to unify Int-Rat-Num-Complex types into a cooperative Numeric space --- which I think is a good design given its untyped default approach
- moonchild 3y ago
- unixhero 3y agoI for one welcome our Raku wielding overlords.
- justinator 3y agoThere's literally dozens of them!
- UncleOxidant 3y agoThe language formerly known as Perl 6. I thought I'd heard of it somewhere.
- beeslol 3y ago> Raku has no qualms about using Unicode operators. You check set membership with ∈. There's also ∉, ∋, and ∌. Something to note is that there are ASCII equivalents[0] for every cool Unicode operator found in Raku. For example, the equivalents for ∈, ∉, ∋, ∌ are (elem), !(elem), (cont), !(cont). [0] https://docs.raku.org/language/unicode_ascii#Other_acceptable_single_codepoints https://docs.raku.org/language/unicode_ascii#Other_acceptabl...
- jp0d 3y agoWho are the target user base for Raku? I remember writing some fun scripts in Perl more than decade ago when I was still in uni. I really liked the language. Is there any benefit for me as a data analyst to learn Raku over another language like Julia?
- unkulunkulu 3y ago> Formerly known as Perl 6. ↩ I’m in a desparate need of a message from Captain Obvious right now. I know nothing about perl
- thyrsus 3y agoPerl was published by Larry Wall in 1987; Perl 5 appeared in 1994 and has been remarkably stable since then -- I have code from 1998 that still works great. It feels like a more powerful sed or awk, and has an enormous available online library at cpan.org. There are many books describing it; start with "Programming Perl" by Larry Wall; get advice on elegance from "Modern Perl" by Chromatic; if you want to build an Internet component smaller than an available module (or get guidance on the implementation thereof), "Network Programming with Perl" by Lincoln Stein is superb.
- llanowarelves 3y ago"If you define a MAIN function, any parameters you give it will be automatically turned into CLI flags." This is actually cool
- lagniappe 3y agoWhat other languages do this? I love it
- orthoxerox 3y agoPractically any language that supports reflection has a library for that.
- xmcqdpt2 3y agoScala 3 does it too https://docs.scala-lang.org/scala3/book/methods-main-methods.html https://docs.scala-lang.org/scala3/book/methods-main-methods...
- dwb 3y agonushell https://www.nushell.sh/book/modules.html#main https://www.nushell.sh/book/modules.html#main https://www.nushell.sh/book/custom_commands.html#flags https://www.nushell.sh/book/custom_commands.html#flags
- maleldil 3y agonushell[0] has this built-in. It's one of my favourite things about it. Python has typer[1] to do this with type hints. It's limited and gets ugly quickly, but I love it for simple scripts. [0] nushell.sh [1] typer.tiangolo.com
- creer 3y agoIsn't this still the usual critique of a language before knowing much about the language? We were used to this with Perl's "line noise". Now we get > Raku has no qualms about using Unicode operators. You have the option. I have used this option because I want my code to be compact and expressive on screen. A good fit for careful, considered, creative unicode usage. Or the ever popular (Jeez that's new): > I hate the sigil thing For me I have been using Raku/ Perl 6 because I loved the expressiveness of Perl's swiss army chainsaw. Raku is Perl to the power of Perl. It's cleaned up. It's expressive. Some massive piles of features have been built up from the good old Perl. It's great. The documentation is good - and does need some continuing work. (The comparison with Perl is tough. Perl documentation was/is just amazing.)
- Kwpolska 3y agoHow do you type the non-ASCII operators? Special keyboard layout? Your editor automatically converting some sequences? Raw Unicode escapes? This seems complicated pointless to me just to save a couple characters.
- codeflo 3y agoWhen I last looked at this -- admittedly years ago at this point -- all Unicode operators had an ASCII alternative. So maybe you could enter the code as Ascii and prettify it into Unicode?
- creer 3y agoInput method: I see this as fundamentally a keyboard input method that needs to be resolved for your setup overall. Not a Raku issue. For now I'm settled on three alternate methods (under linux). The Compose key method, mostly for accented characters. The editor's code point method, in vim Ctrl-v u or U (but you need to know the unicode code point and I don't exactly have them memorized). Or copy and paste from some web character chart. Since this is programming and not texting emoji, I'd rather have a specific, chosen code point so I tend to use the editor's code point input. (But wait, that's not all, you need enough unicode support in your programming font - not very easy on linux.) What's the point: Absolutely not saving typing. The point is to have a more visually distinctive notation. A math blackboard would be full of that. For example, in the code right in front of me I have a U+25C0 e2 97 80 BLACK LEFT-POINTING TRIANGLE as a custom infix operator for two specific data types. I could have overloaded an existing one... but no, the existing one still exists and it should be extra clear which one is used. When that code is in front of me, it's perfectly clear which is which. And now that the symbol is there in the code, it can just be copy-pasted. (For good measure, the unicode code point is specified in the operator's definition - but that's not necessary in day to day editing.)
- Carioca 3y agoI kept reading the post and had a growing feeling of “oh my god, it's like Perl but MORE.” Only when I got to the end I saw the footnote that it's indeed Perl 6
- creer 3y agoWe see so many language critiques or preferences where the visuals seem to have been a main problem. "line noise" "sigils!!!" "too many parentheses" "unicode!!!". Which to me denote languages judged long before being looked at with any care. Should this be a fundamental lesson for language designers? Should languages come with a converter to switch back and forth between the "calm, proper english version" and the "compact, expert mode" visual? (Without mentioning the translated programming languages like BASIC in french and such things which were discussed on HN not long ago.)
- ofrzeta 3y agoWell done. After spending some time with the Raku examples it made me go back and want to learn TLA+.
- petre 3y agoRaku? Nice but, way too much magic, trying to be too smart and ending up being too late and too slow. And I'm happily doing Perl5 for $work, among other things. Going to write my new/other stuff in Ruby. Then I could use Crystal I ever want static typing, a compiler and binaries. Sane tradeoff between magic and a programming language out of Disc World.
- yawgmoth 3y agoCool article. > This isn't weird, lots of languages have multiple dispatch. What is weird is that you can also dispatch based on a runtime predicate of the value. Is it wrong to think of the predicate itself as a type here?
- librasteve 3y agoI don't know if @hillelwayne is watching ... but the raku docs do explain how to use a Grammar to write a calculator https://docs.raku.org/syntax/Creating%20grammars https://docs.raku.org/syntax/Creating%20grammars
- m0rissette 3y agoWow I never see Perl on HN; are we finally gonna see a Perl revival?
- jsf01 3y agoThis is a fascinating language! I am so curious: how does the “anything goes” matcher work? I struggle to imagine how one would implement that ~~ operator.
- mst 3y ago$lhs ~~ $rhs is mostly sugar for $rhs.ACCEPTS($lhs) and then method resolution (including multimethod handling, of course) figures out which ACCEPTS method to call and that does ... whatever the author of the type implemented. ('mostly' because ~~ actually aliases $lhs as $_ and passes $_ as the argument to ACCEPTS)
- 2colours 3y agoYou probably know it well but let me elaborate a bit more "for the sake of the audience": - the left handside is evaluated into a value (let's symbolize this value with $lhs) - this value is passed into the expression on the right handside as the $_ (topic) variable - the expression on the right handside gets evaluated, producing an $rhs value - now, $rhs.ACCEPTS($lhs) is called The funky thing is that the right handside of this operator is an expression, not an evaluated value... it's like an invisible code block. The implementation calls this property of an operator "thunkiness", the expression on one side acting like a thunk rather than something that can be evaluated right away. This is akin to the short-circuiting behavior of && and ||.
- throwawaaarrgh 3y agoI am definitely a gremlin, in a specific sense: I love tools that are quirky and complicated in a way that makes me more productive. But this idea of programming in The Large vs The Small: I disagree with that comparison. A less wise person might assume that means it makes a bad language for The Large work. On the contrary, it's probably just as good as any other language at it, maybe better. The problem, as it was with other gremliny languages, is you need wisdom to use it. Simplest example: using $x instead of @x. Any person who has used a similar language "enough" would never confuse these. In fact, the sigils actually make your life easier when reading the code, because you now know the type (well, the simple type, or with Raku, the interface) just by looking at that variable anywhere it's used. Now you don't have to go look it up, and you can do useful things with the same variable namespace using different sigils. It looks weird, and it's extra characters you shouldn't need, and you need to know what it means to use it, but it can make life easier. (https://www.perl.com/article/on-sigils/ https://www.perl.com/article/on-sigils/) The problem comes for people without wisdom. The people who don't really know what they're doing. They will probably find this gremlin language a living nightmare. These people need a lot of bowling-bumpers and floaties and kevlar gloves and hard hats and GPS. Somebody let them into a store full of sharp objects and they need a lot of padding to navigate it without killing themselves. That doesn't mean you can't build a skyscraper with the gremlin language. It just means the accident-prone unwise non-gremlins can't build a skyscraper with it. But wise gremlins can.
- capitol_ 3y agoThe notion/mindset that "This tool can only be used if you are good enough" is an enormous design smell in my opinion. Tooling exist to help you and your team do the required work as good or fast as possible. If you are using tools to gate keep juniors in your field, or that are unnecessary complex in order to stroke your own ego. Then the tool is more of a weapon against the rest of your organisation instead of something helpful.
- 2colours 3y agoHave to agree with this one, and also, there is something that I think is easy to forget until you actually face code that has been worked on by dozens of people of completely random backgrounds, over decades: your wisdom doesn't necessarily coincide with someone else's wisdom. Context switching across people - and especially people who barely have anything in common - can be really troublesome. You have to know everything that somebody else you work with has ever used.
- anentropic 3y agoTIL circumfix operators...
- 0x445442 3y agoSpeaking in general terms here to avoid NAXALT responses but it’s been my experience that the Raku/Perl crowd enjoy being clever for clever’s sake and are more concerned about the language itself than the problems being solved. I can see advantages of this cleverness for small scripts but extending a language who’s roots are in a Bash replacement to large scale project development seems DOA to me.
- cutler 3y agoRaku also has exact floating point math, eg. 0.1 + 0.2 + 0.3 = 0.6
- cutler 3y agoThere were so many claims in the first couple of years after Perl6/Raku's initial release in December 2015 about how it had the potential to be optimised due to its superior design but here we are nearly 8 years later and it's still takes 10 times as long as Perl 5 to parse a log file with a regex.
- 2colours 3y agoYes, and those claims might have even been real (also, Perl still lags behind on Unicode stuff, or so I heard?)... the thing we like much less to talk about is that there just needs to be somebody to make those optimizations happen. Work on the actual bytecode VMs (or rather just MoarVM at this point) has been desperately lacking.
- cutler 3y agoIs Jonathan Worthington still active within the project? He was the original force behing optimisation if I remember.
- 2colours 3y agoJonathan Worthington has been much going on and off in the recent years. He still had one big optimization project that got completed in 2021 - the new dispatch mechanism - but I don't know about the benchmarks and I doubt it would help with the shear throughput of basic data processing.
- jnordwick 3y agoRaku is what you get when you mix APL and LSD.