|
6macros: discussing the finer points of Perl 6 macros, Qtrees, and how to stay sane | irclog: irclog.perlgeek.de/6macros/today Set by moderator on 28 July 2015. |
|||
|
00:31
vendethiel joined
01:03
vendethiel joined
02:49
ilbot3 joined
04:08
vendethiel joined
07:44
FROGGS joined
08:59
vendethiel joined
09:51
vendethiel joined
10:36
vendethiel joined
10:59
vendethiel joined
11:21
andreoss joined
|
|||
| andreoss | masak: Regarding turning some builtins to methods. Should such method calls be interpreted as a routine stored inside class/type called with `self` as a first argument? | 11:25 | |
| 10.abs() === Int.abs(10) | |||
| s/method calls/methods/ | 11:33 | ||
| masak | no, I don't think so | 12:07 | |
| that seems like mixing up two things | |||
| in 007, Val::Type is a different class than Val::Int, with different methods | 12:08 | ||
| by the way, I started on the builtins-to-methods thing yesterday, but didn't get all that far | |||
| I only split up the t/features/builtins/subs.t into subs.t and methods.t | 12:09 | ||
| next up would be to change all the ASTs in methods.t | |||
| andreoss | masak: basically I wanted to refactor these builtins to Val::Method::Builtin and make them elements of %.properties of each type | 12:25 | |
|
12:27
vendethiel joined
|
|||
| masak | Val::Method::Builtin sounds wrong :) | 12:35 | |
| mostly because every instance of a Val:: type tends to correspond to a value in userland | 12:36 | ||
|
12:42
vendethiel- joined
12:54
ilbot3 joined
13:08
vendethiel joined
|
|||
| andreoss | masak: Val::Sub::Builtin doesn't count? | 13:25 | |
| Val::Method::Builtin would be almost the same class | 13:27 | ||
|
13:58
vendethiel joined
14:46
vendethiel joined
|
|||
| masak | oh, now I see what you want to do | 14:54 | |
| yeah, maybe... | |||
| though methods don't properly exist in 007 separately from subs, so it still feels odd | |||
| andreoss | ok | 15:32 | |
| so Python-style type class would be wrong completely. Int would become an object, and all unresolved property look-ups would be delegated to it | 15:34 | ||
| The way with Val::Method seems to easy. | 15:35 | ||
| masak | there's a `method property` in Runtime.pm | 15:36 | |
| I imagined most of the methods would end up there | |||
| note that the methods that are already there are normal Val::Sub | 15:37 | ||
| nope, sorry, they're Val::Sub::Builtin | |||
| if we feel that `method property` ends up being a general dump for things, we might think of a way to structure it a bit better and/or move those methods to Builtins.pm | 15:38 | ||
| andreoss | masak: Val::Sub::Builtin is a special case | 15:40 | |
| isn't it? | |||
| i see `multi method call(Val::Sub::Builtin ...` | 15:41 | ||
| ok. i see now how it works with `method propery` | 15:46 | ||
|
15:47
Ven joined
|
|||
| masak | yes, it's a special case, because we need to call it in a different way. | 15:48 | |
| I'm hoping at some point we'll get rid of Val::Sub::Builtin completely. | 15:49 | ||
| which is why I moved it from Q.pm into Builtins.pm | |||
| Ven | o/ | ||
|
15:50
vendethiel joined
|
|||
| andreoss | perl6 -Ilib bin/007 -e= 'my a = { b: 10 }; say(a.has("b"))' | 15:50 | |
| should this work? | |||
| masak | yes, I think it should. | 15:51 | |
| ...and it does. phew :) | |||
| it's more interesting what this would do: `my a = 42; say(a.has("abs"))` | 15:52 | ||
| I think that should work, too (doesn't currently) | |||
| Int and the other "primitive" types in 007 aren't object types... but that doesn't stop them from having a bit of object nature, such as having properties | 15:53 | ||
| andreoss | the space after = wasn't necesary | 15:54 | |
| also why not a.^has("a")? | 15:55 | ||
| masak | oh, I didn't even see that | ||
| andreoss | isn't .has a meta-method here? | 15:56 | |
| masak | andreoss: that's a good point | ||
| in this case, we sort of conflate those things | |||
| but... the problem is that in all cases *except* Object, you can ask the type instead of the instance | |||
| with Object, every object is different | |||
| I think the same argument could be made about `a.get("b")` | 15:57 | ||
| anyway, for now they will stay on the object. it may not be super-correct, but it's pretty simple. | 15:58 | ||
| I will keep it in mind, though. | |||
| andreoss++ sergot++ # implementing all the operators in #57 | 15:59 | ||
| hanoi.007 is starting to look pretty good now ;) | |||
| andreoss | infix:<~~> is yet to go | ||
| masak | sergot++ implemented it today | 16:00 | |
| andreoss | okay, i was about to propose renaming it to infix:<is> | 16:01 | |
| for python-ish resemblence | 16:04 | ||
| masak | but Python's `is` does reference comparison, not type matching | 16:07 | |
| andreoss | a is None would still work | 16:11 | |
| masak | yes, but we already have that functionality through infix:<==> | 16:14 | |
| and nothing else would work the same with infix:<~~> | |||
|
16:28
andreoss left
16:31
vendethiel joined
16:54
vendethiel joined
17:19
vendethiel joined
18:07
vendethiel joined
19:01
vendethiel joined
|
|||