diff --git a/rocks/computers/software/langs/raku.md b/rocks/computers/software/langs/raku.md index 5285e18..e80853e 100644 --- a/rocks/computers/software/langs/raku.md +++ b/rocks/computers/software/langs/raku.md @@ -48,18 +48,18 @@ Class Socket { has Int $.sockfd; method new ($path) { - my $mfd = create_socket(); - connect_socket($mfd,$path); - self.bless(sockfd => $mfd); + my $mfd = create_socket(); # This is a function written in C called with NativeCall + connect_socket($mfd,$path); # Idem + self.bless(sockfd => $mfd); # Give the attributes to the object } method send($str) { my $len = $str.chars; - write_to_sock(self.sockfd, $str, $len); + write_to_sock(self.sockfd, $str, $len); # C func } } my $sock = Socket.new("path/to/socket"); -$sock.write("hello from raku!"); +$sock.send("hello from raku!"); Calling C functions from Raku is stupidly easy, to do this only use