🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel! Set by lizmat on 6 September 2022. |
|||
guifa | that worked | 00:00 | |
Xliff | :D | ||
00:00
reportable6 left
00:01
reportable6 joined
00:03
CodeTortoise left
|
|||
guifa | at least in my golfed example | 00:04 | |
I swear I had tried something like it but maybe it was that dummy rule that made the difference | 00:05 | ||
m: grammar G { token TOP {Â :my %*h = :42x; <POT> }; token POT {Â {%*h<y> = 24 } . } }; class A {Â method TOP ($/) {Â say %*h }; method POT ($/) { %*h<z> = 10 } }; G.parse('x',:actions(A)) | |||
camelia | {x => 42, y => 24, z => 10} | ||
guifa | so there action method TOP has access to :42x (set in original TOP), :24y (set in fake top POT) and :10z (set in method for POT) | ||
I'm probably in insane premature optimization time but I wonder if a dozen dynamics are more/less performant than a single hash with twelve keys | 00:10 | ||
Xliff | That's something for jnthn or nine. | 00:18 | |
It would work a treat for now, though. | |||
guifa | yeah, and honestly, this is just going to parse a pattern to generate a code block | 00:19 | |
so as long as the actual code block is hyper optimized, the parsing stage is less important | |||
Xliff | I'm thinking I might try to add this to Javascript::D3 - observablehq.com/@d3/choropleth | 00:20 | |
guifa | I've seen a lot of chatter about D3 but not familiar with it | 00:22 | |
m: 1.234.round(0) | 00:23 | ||
camelia | Attempt to divide by zero when calling .floor on Rational in block <unit> at <tmp> line 1 |
||
guifa | hmmm.... I feel like that should be special cased | 00:24 | |
Nemokosch | I'm not sure who said this so it was probably Zoffix... don't give up the ambition. There is almost nothing "for Jonathan" in the broad sense 😛 | 00:26 | |
Xliff | Nemokosch: However in the immediate sense, there is a definite need for answers you may not have and someone else does :P\ | 00:37 | |
tellable6 | Xliff, I'll pass your message to Nemokosch | ||
Xliff | Knowing the identity of that person is a key skill. | 00:38 | |
guifa: D3 is a set of data visualization routines written in Javascript. They are designed for browser work. They look REALLY good though. Would be nice to have a way to invoke them from Raku. | 00:39 | ||
Javascript::D3 is a way to do this using a command line tool (which outputs HTML) or Jupyter Notebook. | |||
guifa | ah nice | 00:41 | |
I keep meaning to get something really simple together that can pop open a window and allow Raku to insert either HTML or just give an editable bitmap to | |||
I feel like such a thing shouldn't be tooooooooo hard to do (at least not the bitmap one) but you know how it goes... other projects | 00:42 | ||
Xliff | Could always use Raku to output Javascript to a browser and have it draw on a <CANVAS> | ||
guifa | Yeah | 00:44 | |
I think what I'd want to do though is let it pop open a native window and just have the whole window contents be the page | |||
and juse use the OS html renderer or something of that sort | 00:45 | ||
guifa is thinking of how simple Python makes for drawing to the screen, and that could be nice for Raku to have too | 00:46 | ||
Xliff | Yep. | 00:52 | |
Nemokosch | how do you draw to the screen in Python? | 00:55 | |
01:02
xinming joined
|
|||
guifa | the module Turtle | 01:03 | |
Xliff | (aka Logo! :> ) | 01:05 | |
guifa | yup | 01:06 | |
I'd rather get something even more basic, upon which other modules could build | |||
like literally "use Canvas; my $a = Canvas.new(:640x, :480y); $a.display;" | 01:07 | ||
that would just create a 640x480 pixel buffer, and other modules could interact with it (e.g line drawing or graphics drawing) | |||
THe trick of course is it's like my User:: modules… it'll need to be a bit different for each OS | 01:08 | ||
Nemokosch | oh no, please no more Logo 😄 | 01:14 | |
okay, using turtle graphics from a language that isn't designed to be useless might give a moral boost | |||
guifa | I think the advantage of a module like Turtle is that it can add a nice visual component for beginner programmers | 01:19 | |
Nemokosch | I have been "traumatized" by Logo - more accurately, by *never being told this was programming* | 01:20 | |
all I knew is that we are doing Paint in an annoyingly overcomplicated way | |||
01:21
CodeTortoise joined
|
|||
also, not saying everybody is like me in this regard but I absolutely loved just messing around with a rich command line interface provided by Free Pascal | 01:21 | ||
I really wish Raku had something that could compete with the crt module | 01:22 | ||
something that does work for all major OS'es | |||
01:50
CodeTortoise left
02:29
jpn joined
02:34
jpn left
02:58
Xliff left
03:04
Homer_Simpson joined
|
|||
Homer_Simpson | how do you change the string which I got from user input from 'pass' to 'past' | 03:06 | |
tellable6 | 2022-12-30T20:51:47Z #raku <guifa> Homer_Simpson: you can write your own operator to that. It's extremely easy if you're okay with including a quote mark, a bit more complicated if you want just the grave accent and nothing more | ||
Homer_Simpson | I tried just trying to get a single character from keyboard, nothing would work even fixed size arrays and fixed size lists still got 4 chars, or said im trying to change the immutable value by prompt/get and say/printing it | 03:07 | |
if it was a string literal or a string literal constant doing $str++; works, it starts at the end of the string however | 03:08 | ||
guifa how would you write your own operator | 03:09 | ||
just ` on its own is invalid yes. | |||
L`a` is invalid as is `π` because π is 2 bytes long and a is only 1 byte but is trying to fit inside of 2 bytes. however ` ` also means string as long as there is more than one character in it | 03:11 | ||
so `Ï€a`is fine as would be L`Ï€a` | 03:12 | ||
maybe instead of having $`` and the same with other sigils just make a type called Char | 03:13 | ||
then you can do stuff like: my Char $c = 97; prinf("%c", $c); # a | |||
then you can do stuff like: my Char $c = 97; printf("%c", $c); # a | 03:14 | ||
03:23
Kaiepi left
|
|||
Homer_Simpson | oh ok an operator is really a subroutine | 03:26 | |
03:32
razetime joined
|
|||
Voldenet | don't write your own operators | 04:26 | |
it's cool that you can, but it's extremely confusing later | |||
>how do you change the string which I got from user input from 'pass' to 'past' | 04:29 | ||
m: my $input = "pass"; $input ~~ s/s$/t/; say $input | |||
camelia | past | ||
04:32
linkable6 left,
evalable6 left
04:34
evalable6 joined,
linkable6 joined
05:14
jpn joined
05:19
jpn left
05:23
squashable6 left
05:24
squashable6 joined
05:25
CodeTortoise joined
05:37
CodeTortoise left
06:00
reportable6 left,
reportable6 joined
|
|||
Homer_Simpson | regex is cheating | 06:01 | |
07:00
linkable6 left,
evalable6 left
07:01
evalable6 joined
07:03
linkable6 joined
07:30
derpydoo joined,
razetime left
07:31
razetime joined
07:51
razetime left
08:39
razetime joined
09:00
andrea[m] left,
jpn joined
09:04
jpn left
09:17
squashable6 left
09:20
squashable6 joined
|
|||
Voldenet | cheating? Would you look at this solution | 09:23 | |
m: my $input = "pass"; $input = $input ?? "past" !! $input; say $input | |||
camelia | past | ||
Voldenet | erm | ||
m: my $input = "pass"; $input = $input eq "pass" ?? "past" !! $input; say $input | |||
camelia | past | ||
Voldenet | now that's a hacky solution | 09:24 | |
pure cheating | |||
m: "pass".&parse-base(36).&{ $_ + 1 }.base(36).say | 09:28 | ||
camelia | PAST | ||
Voldenet | it takes creativity to cheat properly | ||
m: my $input = Buf.new: "pass".encode; $input[$input.end] = $input[$input.end] + 1; say $input.decode | 09:36 | ||
camelia | past | ||
Voldenet | m: my $input = Buf.new: "pass".encode; $input[$input.end]++; say $input.decode | 09:37 | |
camelia | past | ||
Voldenet | m: my $input = Buf.new: "~~~".encode; $input[$input.end] += 2; say $input.decode | 09:40 | |
camelia | Malformed UTF-8 near bytes 7e 80 at line 1 col 3 in block <unit> at <tmp> line 1 |
||
Nemokosch | Voldenet++ 🤣 | 09:47 | |
Voldenet | that question has so many edge cases though, like what representation of a character should it use | 09:49 | |
what happens on overflow | |||
etc. | |||
Nemokosch | anyway Homer_Simpson please forget about it. If you want proper string processing in a language, you CANNOT aim for C strings | 09:51 | |
Voldenet | ^ | 09:54 | |
if you want a proper language, you cannot aim for C | |||
aiming for C is undefined behaviour that can destroy the world if compiler wishes so | 09:55 | ||
Nemokosch | Well I think C is an excellent language for getting commonsensical abstractions for real cheap. But "abstractions" need to be understood from assembly and physical hardware point of view, not math point of view | 09:56 | |
What I do kind of hate that C was praised over Pascal for things like passing arrays as pointers and null-terminated strings | 09:57 | ||
these turned out to be horrible design mistakes later on | 09:58 | ||
so thank you very much, Brian Kernighan 🤣 | |||
Voldenet | C is an excellent language for CVEs | ||
Nemokosch | nah, tbh I wouldn't blame the stupidity of an average Joe on C | 09:59 | |
UB itself is overrated. You cannot hit undefined behavior without doing something very apparently nonsensical. | 10:01 | ||
Voldenet | you can dereference null by accident and it's more common that you might think | ||
Nemokosch | yes, "by accident". But nobody in their right mind would deliberately do that. It's an apparent mistake. | 10:02 | |
10:04
sena_kun joined
|
|||
I'm not saying C is my favorite language. One can think of the horrible include system, ugly typedefs or the sole fact that arrays are more or less a hack. | 10:04 | ||
10:04
Homer_Simpson left
|
|||
But I absolutely don't buy this sentiment for C or any other language that the language is to blame for *very apparent* mistakes people have done over time. | 10:04 | ||
Voldenet | the result of similar apparent mistakes in C are heartbleed-class bugs | 10:05 | |
Nemokosch | yes but why don't we blame the people for that? | 10:06 | |
Voldenet | in java things just crash, which is more sane default | ||
Nemokosch | well, have you ever seen Java compiled to machine code? | 10:07 | |
Voldenet | I wasn't that deep into it, I've seen C# compiled into machine code | ||
Nemokosch | I'm pretty sure this "will it crash" just downright falls out of the scope of the language. It's something the runtime provides. | 10:08 | |
and it's really tempting to say that C literally has no runtime | |||
Voldenet | No! It's something that language provides | 10:10 | |
Nemokosch | C doesn't even provide memory management, mind you | 10:12 | |
not heap management, that is | |||
like literally it's not part of the language. Part of the reason it's so easy to implement on whatever hardware | 10:13 | ||
Voldenet | it's easy to implement because things are so unspecified or undefined | 10:14 | |
Nemokosch | nah, this is just an empty cliché | 10:15 | |
either an empty cliché or not understanding what specifying e.g memory management for various hardware for 40 years would even mean | 10:16 | ||
Voldenet | I'm not blaming C for the choices it made, I'm just saying that it's not the best language to use as a model for anything modern | 10:17 | |
Nemokosch | ironically enough, we ended up in a situation where e.g `int` is conserved as a 4 byte int on 64bit PC's, simply because it became so widespread. So it did become de facto specified and for the wrong reasons. | 10:18 | |
10:23
jpn joined
|
|||
Anyway, for now, I'm (mostly) writing C for a living, and I could tell you about things that can go wrong, or how I dislike the very starting point that legacy SUN Pascal code was ported to C or some completely obsolete C++, rather than moving with Free Pascal and iteratively replacing the mess with saner, more modern code | 10:23 | ||
I absolutely know how often it happens that the system has had a memory mistake for 30 years but it just didn't break on Solaris and now all of a sudden, it does break on Linux | 10:24 | ||
Voldenet | Int might be 4 bytes, but how many bits are in a byte? :> | 10:25 | |
I'm really glad that some standards exist here | 10:26 | ||
Nemokosch | and it's also obvious that with state of art compilers nowadays, the situation is completely different from the "days of C", like one can really just mash a lot more into a compiler | ||
on the other hand, I cannot like when C takes the blame for the fact that the whole software industry was very young and immature, and people simply didn't care about the possible consequences of certain mistakes | 10:28 | ||
Voldenet | but C was there at the time of the crime, of course it takes the blame | 10:31 | |
Nemokosch | C was more a witness than a commiter though | 10:32 | |
10:33
Sgeo left
10:34
Kaiepi joined
|
|||
take this hypothesis: C played a much bigger role in the industrial boom than in the vulnerabilities themselves; it's rather the industrial boom itself that put more pressure on being aware and avoiding the vulnerabilities | 10:35 | ||
11:20
jpn left
11:37
Sauvin left
11:38
Sauvin joined,
Sauvin left
11:40
Sauvin joined,
Sauvin left
11:42
tejr left
11:44
Sauvin joined,
Sauvin left
11:45
epony left
11:46
Sauvin joined,
Sauvin left
11:47
Sauvin joined
11:50
Sauvin left
11:51
Sauvin joined,
Sauvin left
11:53
Sauvin joined
12:00
reportable6 left
12:03
reportable6 joined
|
|||
guifa | Homer_Simpson: sub circumfix:<` `> (Str() $foo) {Â $foo.comb }; my @a = `'abc'`; say @a | 12:17 | |
tellable6 | guifa, I'll pass your message to Homer_Simpson | ||
guifa | m: sub circumfix:<` `> (Str() $foo) { $foo.comb }; my @a = `'abc'`; say @a | ||
camelia | [a b c] | ||
12:41
tejr joined
13:38
Homer_Simpson joined
14:22
jpn joined
14:25
razetime left
|
|||
Voldenet | Nemokosch: C vulnerabilities just didn't matter in times before everything was connected to everything else ;) | 14:46 | |
tellable6 | Voldenet, I'll pass your message to Nemokosch | ||
14:48
derpydoo left
|
|||
Voldenet | that `` syntax is awkward | 14:48 | |
m: sub prefix:<@> (Str() $foo) { $foo.comb }; my @a = @"abc"; say @a | |||
camelia | [a b c] | ||
Voldenet | consider this | ||
14:49
derpydoo joined,
jgaz joined
|
|||
Nemokosch | Voldenet: this but frankly, you can remove "C" from that sentence | 15:09 | |
It's not particularly a C thing | |||
15:16
rf joined
15:22
jpn left
15:33
derpydoo left
15:59
Homer_Simpson left
16:18
epony joined
16:25
jgaz left
16:39
jpn joined
17:03
jgaz joined
17:30
abraxxa-home joined
17:31
jgaz left
17:45
derpydoo joined
|
|||
Geth | ecosystem/main: 81a4ba8e04 | thundergnat++ (committed using GitHub Web editor) | META.list Migrate module to fez ecosystem |
17:45 | |
18:00
reportable6 left
18:01
reportable6 joined
18:11
newuserofraku left
18:26
jpn left
18:53
Kaipei joined
18:57
Kaiepi left
19:03
Kaipei left
19:04
Kaipei joined
19:28
Kaipii joined
19:32
Kaipei left
19:45
xinming left,
xinming joined
|
|||
Nemokosch | anyone already living in 2023? 😄 | 19:53 | |
20:00
abraxxa-home left
20:12
CodeTortoise joined
20:15
Sgeo joined
20:18
xinming left,
xinming joined
20:41
CodeTortoise left
|
|||
Anton Antonov | <@297037173541175296> Not yet. I just published a blog post I wanted to finish before the end of the year. 😎 | 21:01 | |
Nemokosch | 💪 | 21:20 | |
21:41
linkable6 left,
evalable6 left
21:43
linkable6 joined
21:44
evalable6 joined
22:03
Homer_Simpson joined
22:37
CodeTortoise joined
23:15
jgaz joined
23:29
CodeTortoise left
23:32
melezhik joined
|
|||
melezhik | Happy New Year to everyone ! 🌲🌲🌲 | 23:32 | |
Nemokosch | 🤗 | 23:33 | |
melezhik | we still have it coming in 6 and halve hours in TX, Houston ... ))) | 23:38 | |
Nemokosch | ~~the homeland of fat people~~ | 23:39 | |
23:41
melezhik left
23:57
jaguart left
|