One 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 ass…
The 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…
Raku: A language for gremlins
251–257 of 257 posts
Re: Raku: A language for gremlins
#252Earlier quoted context omitted.
This was early Perl code for me (early 2000s). Write once; read never. Once you and your teammates developed some discipline, it got much better.
I think that this is the crux of the story for raku ... if you want you language to apply a standard discipline, then use Python: if you are happy with your team developing a dialect that balances usability with discipline, then try Raku
if you want you language to apply a standard discipline, then use Python
Wow, I hear this stuff all the time about Python. It is a myth. I have worked on multiple 500K+ line Python projects. All of them decay into a total mess due to weak typing. You can type hint until you are blue in the face, but it is never enough if it isn't guaranteed by a compiler or at runtime. So many times, I am 29-levels deep in a call stack, looking at a local variable that is incorrect typed, thinking to myself: "Oh fuck, this again." Yes, I will get 8,000 downvotes for that comment, but it does not detract from my personal experience. It takes super human talent to fight that trend. Have you seen what Dropbox did with that Finnish dude who got a PhD literally studying how to make Python more type safe with static analysis? Jesus fuckin' Christ: Amazing work, but it would be much easier to pick a different language for something that will grow to millions of lines of code! And, sadly, I write that sentence as an unashamed Python fan-boi. I truly wish there was some kind of "strict-er typed" Python mode -- or something.Re: Raku: A language for gremlins
#253Earlier quoted context omitted.
> The apparent variance between list syntax accepted by the reader and emitted by the printer Could you provide an actual example for this? I suspect this is a simple misunderstanding. > 'o' for function composition? Square brackets to reduce over an operator? Square brackets with a backslash to map? I never used 'o' myself but YES, square brackets to reduce over an operator. Indeed, I see nothing wrong with that (ok…
> Could you provide an actual example for this? Lists are given to the reader in angle brackets and printed in parentheses, or at least that's how it looks. I suppose the other possibility is that these are actually different types, but I'm not sure that's better. "Produce" is a term I've never seen used this way before, and I assume it is unique to Raku. It appears to be a special case of reduction, not at all commo…
> "Produce" is a term I've never seen used this way before, and I assume it is unique to Raku.
More commonly referred to in the functional languages as a `scan`, but yes, it seems that `produce` might be unique to Raku. I've not seen `accumulate` outside of Python, but there's a lot of langs so who knows.code_report (Conor Hoekstra) has discussed the difference names of `scan` on a couple occasions, eg: https://twitter.com/code_report/status/1246494250537291776
Connor has declared a fondness of APL's where fold and scan show a clear visual relation: `/` & `\`. I suspect Raku was shooting for something similar with it's choices:
[f] list # or list.reduce(f)
[\f] list # or list.produce(f)
Re: Raku: A language for gremlins
#254Earlier quoted context omitted.
I think that this is the crux of the story for raku ... if you want you language to apply a standard discipline, then use Python: if you are happy with your team developing a dialect that balances usability with discipline, then try Raku
if you want you language to apply a standard discipline, then use Python Wow, I hear this stuff all the time about Python. It is a myth. I have worked on multiple 500K+ line Python projects. All of them decay into a total mess due to weak typing. You can type hint until you are blue in the face, but it is never enough if it isn't guaranteed by a compiler or at runtime. So many times, I am 29-levels deep in a call sta…
There were already several 1M+ Perl LoC code bases by the end of the 1990s, as Perl use exploded at places like Amazon.
One key driver of Raku's design was making it easy to write large, clean, readable code bases, and easy to enforce coding policies if and when a dev team leader chose to.
(Of course, as with any PL, you can write messy unreadable code -- and you can even write articles and record videos that make it seem like a given PL is only for Gremlins. But it's so easy to write clean readable code, why wouldn't you do that instead?)
> type hint ... is never enough if it isn't guaranteed by a compiler or at runtime
Indeed. Type hints are a band aid.
Raku doesn't do hints. Raku does static first gradual typing.[1]
The "static first" means static typing is the foundation.
The "gradual typing" means you don't have to explicitly specify types, but if you do types, they're always enforced.
Enforcement is at compile time if the compiler's static analysis is good enough, and otherwise at run time at the latest.
For example, in the Gremlins article only one example uses a static type (`Int`). But user code can and routinely does include types, and they are enforced. For example:
sub double(Int $x) { $x * 2 }
double '42'
results in a compile time error: SORRY! Error while compiling ...
Calling double(Str) will never work with declared signature (Int $x)
(Int $x)
> total mess due to weak typingI know what you mean, but to be usefully pedantic, the CS meaning of "weak typing" can be fully consistent with excellent typing discipline. Let me demonstrate with Raku:
sub date-range(Date $from, Date $to) { $from..$to }
The subroutine (function) declaration is strongly typed. So this code... say date-range '2000-01-01', '2023-08-21';
...fails at compile time.But it passes and works at run time if the function declaration is changed to:
sub date-range(Date() $from, Date() $to) { $from..$to }
(I've changed the type constraints from `Date` to `Date()`.)The changed declaration works because I've changed the function to be weakly typed, and the `Date` type happens to declare an ISO 8601 date string format coercion.
But what if you wanted to insist that the argument is of a particular type, not one that just so happens to have a `Date` coercion? You can tighten things up...
sub date-range(Date(Str) $from, Date(Str) $to) { $from..$to }
...and now the argument has to already be a `Date` (or sub-class thereof), or, if not, a `Str` (Raku's standard boxed string type), or sub-class thereof, that successfully coerces according to `Date`'s ISO 8601 coercion for `Str`s.Re: Raku: A language for gremlins
#255Earlier quoted context omitted.
if you want you language to apply a standard discipline, then use Python Wow, I hear this stuff all the time about Python. It is a myth. I have worked on multiple 500K+ line Python projects. All of them decay into a total mess due to weak typing. You can type hint until you are blue in the face, but it is never enough if it isn't guaranteed by a compiler or at runtime. So many times, I am 29-levels deep in a call sta…
> I have worked on multiple 500K+ line Python projects. There were already several 1M+ Perl LoC code bases by the end of the 1990s, as Perl use exploded at places like Amazon. One key driver of Raku's design was making it easy to write large, clean, readable code bases, and easy to enforce coding policies if and when a dev team leader chose to. (Of course, as with any PL, you can write messy unreadable code -- and yo…
* The compiler may reject the code at compile time for failing to type check; and, if it doesn't:
* The compiler will reject the code at run time for failing to type check unless it's either a `Date`, or a `Str` that successfully coerces to a `Date`.
Re: Raku: A language for gremlins
#256Earlier quoted context omitted.
> Could you provide an actual example for this? Lists are given to the reader in angle brackets and printed in parentheses, or at least that's how it looks. I suppose the other possibility is that these are actually different types, but I'm not sure that's better. "Produce" is a term I've never seen used this way before, and I assume it is unique to Raku. It appears to be a special case of reduction, not at all commo…
> "Produce" is a term I've never seen used this way before, and I assume it is unique to Raku. More commonly referred to in the functional languages as a `scan`, but yes, it seems that `produce` might be unique to Raku. I've not seen `accumulate` outside of Python, but there's a lot of langs so who knows. code_report (Conor Hoekstra) has discussed the difference names of `scan` on a couple occasions, eg: https://twit…
.say for [\**] 2,3,4
4 # 4
81 # 3 ** 4
2417851639229258349412352 # 2 ** 3 ** 4Re: Raku: A language for gremlins
#257Earlier quoted context omitted.
> Could you provide an actual example for this? Lists are given to the reader in angle brackets and printed in parentheses, or at least that's how it looks. I suppose the other possibility is that these are actually different types, but I'm not sure that's better. "Produce" is a term I've never seen used this way before, and I assume it is unique to Raku. It appears to be a special case of reduction, not at all commo…
> "Produce" is a term I've never seen used this way before, and I assume it is unique to Raku. More commonly referred to in the functional languages as a `scan`, but yes, it seems that `produce` might be unique to Raku. I've not seen `accumulate` outside of Python, but there's a lot of langs so who knows. code_report (Conor Hoekstra) has discussed the difference names of `scan` on a couple occasions, eg: https://twit…
> TimToady: is it okay to rename the 'reduce' builtin to 'fold' and add one for 'scan'? My understanding is that 'reduce' is the general term for them both.
[1] https://irclogs.raku.org/search.html?query=produce+reduce&ty...
[2] https://irclogs.raku.org/perl6/2006-05-15.html#17:10-0001