🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
Xliff \o 01:00
xinming m: module A { class B { }; class B::C { } }; B.raku.say; 03:56
camelia A::B
xinming In this example, we don't have B declared in global namespace, But we have `constant B = A::B` alias, Is this a bug?
xinming_ SmokeMachine: paste.debian.net/1169329/ <--- Where did I do wrong in this example? 07:05
SmokeMachine xinming_: interesting code! Is that giving error? I’m not sure if I ever tested a column being a pk and a fk at the same time 12:38
xinming_ SmokeMachine: Yea, It'll report an error 12:42
Something like, Type check failed in assignment to $!right; expected Red::AST but got Slip (Empty) 12:43
SmokeMachine xinming_: would you mind to open a issue with that? I’ll take a look 12:44
xinming_ SmokeMachine: github.com/FCO/Red/issues/449 12:53
SmokeMachine It should be referencing *.id and not *.a-id 12:59
xinming_: it should be referencing *.id and not *.a-id and it’s :references instead of :referencing 13:00
xinming_ m: m: module A { class B { }; class B::C { } }; B.raku.say;
camelia A::B
xinming_ m: module A { class B { }; class B::C { } }; B.raku.say;
camelia A::B
SmokeMachine (Sorry my app haven’t showed me my first message) 13:01
xinming_ SmokeMachine: So, you mean something like: has Int $.a-id is column{ :id, :references(*.id, :model-name<A>) }; 13:02
??
SmokeMachine Yes
xinming_ then, we'll get this error: On Red:api<2> references must declaire :model-name and the references block must receive the model as reference 13:03
I tried both :model-name<A> and :model(A) and :model<A>
Hmm, ignore me, I'll try again 13:04
SmokeMachine Sorry, I’ll try it... just not with my computer right now
Odd: github.com/FCO/Red/blob/master/lib...ts.pm6#L69 13:06
xinming_ SmokeMachine: works with has Int $.a-id is column{ :id, :references(*.id), :model-name<A> } 13:07
BTW, How do we declare has-one relationship? in that example, we can have $a-result an accessor to the b 13:08
SmokeMachine So, is that working now? 13:09
Sorry, that is a has-one relationship, isn’t it? 13:10
xinming_ has Int $.a-id is column{ :id, :references(*.id), :model-name<A> } <--- This version works
SmokeMachine: The B to A is a belongs-to relationship
But A might-have a B 13:11
is not belongs-to
I'll trouble you later before I try more.
SmokeMachine Currently the only way would be treat that as a has-many, adding a @ sigil on that 13:12
xinming_ Ok, doesn't seem to be a good sollution. 13:14
BTW, for views, I think we can do something like, `model x is view('aaa')` to mean view created, and `model x is view { }` to mean virtual views. 13:15
SmokeMachine xinming_: about the pk and fk at the same time, would you do me a favor? Would you mind to write that as a cookbook entry, please? fco.github.io/Red/tutorials/cookbook.html
xinming_ Then, we can do something like, model x is view(view-name) is content('view-definition') { has $.a is column; has $.b is column; } 13:16
SmokeMachine: Ok, will do that.
SmokeMachine About the created views I was thinking of using the `is temp` that already exists... but I’m not sure if it’s a good idea 13:17
xinming_ `is temp` is used for creating temp table, I don't think it's a good idea. 13:18
BTW, when I read the source code about `is temp`, it got me thinking, is there a way to curry the temp table with predefined table name? 13:19
SmokeMachine Yes, makes sense
Not sure... 13:20
xinming_ For example, TmpModel is temp { }; then in code, we can do something like, my $user-specific-tmp-table = TmpModel.^create-temp-table: :table-name<abc>
Then, $user-specific-tmp-table will just curry the TmpModel with predefined table-name to query. 13:21
Is that a good idea? 13:22
SmokeMachine I think so... but I wouldn’t call that `create-tmp-table` it’s already defined as temp... maybe just a `create-table` should be enough 13:26
xinming_ BTW, is it possible for us to do something like `temp Model.table-name = 'new-table'` name now? 13:27
How do we change the table name at runtime?
SmokeMachine Maybe a TmpModel.^alias(“otherName”).^create-table` should work
xinming_ SmokeMachine: I think it's best to hold the curried model within a variable. 13:28
SmokeMachine Not sure... would you mind if I search for that in a few moments? I’m doing the dishes now... 13:29
xinming_ Ok
SmokeMachine xinming_: this seems to work, but I don't think that's a goos way of doing that... www.irccloud.com/pastebin/eCIfE3u6/ 14:04
xinming_ SmokeMachine: There are some places where it saves a lot of times, Which is like, we have 2 table, one is archive, and another is live data table. 14:27
SmokeMachine: I've created the pull request for the doc/cookbook.md update. BTW, I have another branch which is mostly postgres fix, I'll enchance when I have time. Now busy with other things. 14:39
xinming_ m: module A { class B { }; class B::C { } }; B.raku.say; # <-- in this example, The namespace B is created globally, Is this a bug or a feature? 15:09
camelia A::B
xinming_ SmokeMachine: How do we specify the column type of database? now, I found that most column types are incorrect, `has DateTime $.dt is column` emits VAR(255) length string. 16:05
SmokeMachine you can use :type for defining that 16:06
SmokeMachine xinming_: this is the reason: github.com/FCO/Red/blob/master/lib...L.pm6#L762 16:20
xinming_ SmokeMachine: I know, I think it's best that we specify it manually, also, we specify the default value for the database literraly 16:25
SmokeMachine xinming_: sorry, I didn't get it... 16:29
xinming_ SmokeMachine: model A { has DateTime $.dt is column = DateTime.now }; Wether we can do something like, model A { has DateTime $.dt is column{:type<timestamp>, :default<now>} } 16:32
Will generate sql which is like CREATE TABLE aa { dt timestamp NOT NULL DEFAULT now }; 16:33
SmokeMachine: model A { has DateTime $.dt is column = DateTime.now }; Wether we can do something like, model A { has DateTime $.dt is column{:type<timestamp>, :default('now()')} }
If people want the 'now()' to be string, We can do something like :default(q{'now()'}) 16:34
SmokeMachine xinming_: I'm still deciding how to do the default value... I don't really like to make it with "SQL" 16:35
xinming_ SmokeMachine: We still need that feature finally. We can have the most sane default, But we do need a way to inject the plain SQL some way. 16:36
SmokeMachine xinming_: I'm more like doing something like: `has DateTime $.dt is column{:type<timestamp>, :default{ .now }} `
xinming_ Yea, the .now is an example. What if we want an xml column, with default xml? 16:37
Or geo location column in pg. I know you hate plain sql, But you can't avoid it
SmokeMachine maybe using something like this: github.com/FCO/Red/blob/master/lib...ds.pm6#L65 16:38
xinming_ I face this many times in p5 DBIC.
SmokeMachine in that case ww could use Red::AST::Function 16:39
or use something like RED::AST::Generic (github.com/FCO/Red/tree/master/lib...T/Generic)
xinming_ Ok, Will follow your decision. ;-) 16:41
xinming_ m: ("a" ~~ Str).raku.say; 16:47
camelia Bool::True
xinming_ m: my $_ = "a"; Str.ACCEPTS($_); # docs.raku.org/routine/~~ <--- Am I right understanding the smart match operator? 16:48
camelia Potential difficulties:
Redeclaration of symbol '$_'.
at <tmp>:1
------> 3my $_7⏏5 = "a"; Str.ACCEPTS($_); # do
»
xinming_ m: temp $_ = "a"; Str.ACCEPTS($_); # docs.raku.org/routine/~~ <--- Am I right understanding the smart match operator?
camelia ( no output )
xinming_ m: temp $_ = "a"; Str.ACCEPTS($_).raku.say; # docs.raku.org/routine/~~ <--- Am I right understanding the smart match operator?
camelia Bool::True
xinming_ Left is aliased to $_, then, call the .ACCEPTS method from the right hand side.
after some testing, seems I'm right. 16:50
SmokeMachine .tell kawaii I've closed github.com/FCO/Red/issues/448, but if you think it's not ok yet, please open it again. 17:47
tellable6 SmokeMachine, I'll pass your message to kawaii
kawaii SmokeMachine: I didn't have any problems with it, but I'm not using named uniques, just multiple, it's probably fine :) 18:59
tellable6 2020-10-31T17:47:17Z #raku <SmokeMachine> kawaii I've closed github.com/FCO/Red/issues/448, but if you think it's not ok yet, please open it again.
Geth doc: a21340f2b2 | Coke++ | 2 files
Make dep on Documentable "official"

Update build directions to install deps from META6.json
19:13
Geth ¦ doc: coke self-assigned Spin off Pod::Convenience github.com/Raku/doc/issues/2696 19:33
[Coke] .ask jjmerelo - to avoid github ticket volleyball, do you agree that we should reject tickets regarding 'p6doc' executable since it is no longer in the repo? If so, I'm happy to do the ticket cleanup. 19:35
tellable6 [Coke], I'll pass your message to jmerelo
[Coke] .ask jjmerelo - I will also save the list of tickets for the new repo so whoever owns it can extract the bug info if they need it.
tellable6 [Coke], I'll pass your message to jmerelo
[Coke] ... I do like that it dealt with my typo. 19:39
Geth ¦ doc: coke assigned to Altai-man Issue Convert static site to dynamic site github.com/Raku/doc/issues/1246 19:41
Geth ¦ doc: Altai-man self-assigned Test documentable github.com/Raku/doc/issues/2972 20:03
cpan-raku New module released to CPAN! Universal::errno (0.0.3) by 03GARLANDG 20:18
Zero_Dogg [Coke]: Is there a replacement for p6doc? 20:23
[Coke] Zero_Dogg: github.com/Raku/rakudoc 21:01
no idea if it's in a better state than p6doc was.
Zero_Dogg well, p6doc isn't installable at all, so if it installs, that'll be an improvement (though it's not on cpan it seems) 21:03
[Coke] p6doc isn't in the repo anymore. 21:06
(and yes, before that it was super busted.)
Zero_Dogg 'zef install p6doc' does try to install something, though
granted, it fails at it, but still
[Coke] Can't speak to that one. There was one in raku/doc before that's gone now. 21:09
Zero_Dogg rakudoc fails its tests. Sigh. perldoc has spoiled me. 21:11
JustThisGuy Hi all! Given a codepoint e.g. 1F1E9 1F1EA I want to be able to get .uniname. I've been googling and reading the docs, and I see that .NFC returns a codepoint, but I want to do the inverse and create a string from a codepoint. Thanks!
moritz m: say "\x[1F1E9,1F1EA]" 21:15
camelia 🇩🇪
moritz JustThisGuy: or do you want to create a string from the codepoint name? 21:16
JustThisGuy m: say "\x[1F1E9,1F1EA]".uniname
camelia REGIONAL INDICATOR SYMBOL LETTER D
moritz m: say "\x[1F1E9,1F1EA]".uninames 21:17
camelia (REGIONAL INDICATOR SYMBOL LETTER D REGIONAL INDICATOR SYMBOL LETTER E)
JustThisGuy That's what's confusing me is "REGIONAL INDICATOR SYMBOL LETTER D". I'm looking for "German Flag" or similar.
moritz well, there's the official Unicode database, which mostly has just one name for each codepoint. That's what Raku offers you 21:18
if you want other names for that, you must look elsewhere for other data sources that map "vulgar" names to codepoints
JustThisGuy OK. Thanks! 21:19
cpan-raku New module released to CPAN! Red (0.1.27) by 03FCO 21:50
cpan-raku New module released to CPAN! Universal::errno (0.0.4) by 03GARLANDG 22:05
Xliff \o 23:07
How would one go searching a Buf for a byte pattern? 23:08
[Coke] (german flag) - the flags are combos of the 2 letter country ids. 23:20
m: say "\C[REGIONAL INDICATOR SYMBOL LETTER D][REGIONAL INDICATOR SYMBOL LETTER E
camelia 5===SORRY!5=== Error while compiling <tmp>
Unrecognized backslash sequence: '\C'
at <tmp>:1
------> 3say "\7⏏5C[REGIONAL INDICATOR SYMBOL LETTER D][RE
expecting any of:
argument list
double quotes
te…
[Coke] m: for <F G> -> $l { say "\c[REGIONAL INDICATOR SYMBOL LETTER D]\c[REGIONAL INDICATOR SYMBOL LETTER $l]" 23:22
camelia 5===SORRY!5=== Error while compiling <tmp>
Unrecognized character name [REGIONAL INDICATOR SYMBOL LETTER $l]
at <tmp>:1
------> 3D]\c[REGIONAL INDICATOR SYMBOL LETTER $l7⏏5]"
Xliff Huh! For now I had to roll my own: sub c-decode ($b) {
my $i = 0; $i++ while $b[$i]; $b.subbuf(0, $i).decode }
[Coke] awwww
m: for <F G> -> $l { say "\c[REGIONAL INDICATOR SYMBOL LETTER D]" ~ "REGIONAL INDICATOR SYMBOL LETTER $l".parse-names } 23:24
camelia 🇩🇫
Saw 1 occurrence of deprecated code.
================================================================================
Method parse-names (from Str) seen at:
<tmp>, line 1
Please use uniparse instead.
----------------------------…
[Coke] m: for <E G> -> $l { say "\c[REGIONAL INDICATOR SYMBOL LETTER D]" ~ "REGIONAL INDICATOR SYMBOL LETTER $l".uniparse } # yes?
camelia 🇩🇪
🇩🇬
[Coke] whew.
Geth doc/coke/pod: 747898fca8 | Coke++ | 5 files
Switch to POD::Utilities
23:39