Perl 6 - the future is here, just unevenly distributed

IRC log for #perl11, 2017-08-16

| Channels | #perl11 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:49 yukikimoto joined #perl11
01:03 yukikimoto Good morning, I try dynamic link library in SPVM.
02:29 yukikimo_ joined #perl11
03:50 sten joined #perl11
04:11 willthechill joined #perl11
04:12 willthechill yukikimo_: good job!  :-)
04:13 yukikimo_ Hi, will
04:15 yukikimo_ it seems like you try perl core string and locale. I offten see perl git.
04:16 yukikimo_ I'm in summer vacation.
08:15 yukikimoto joined #perl11
11:39 sten joined #perl11
15:26 anton_p joined #perl11
15:37 lizmat joined #perl11
17:03 willthechill joined #perl11
19:18 anton joined #perl11
19:51 jnap willthechill: you around?  I can't figure out if RPerl properties are allowed to be optional, or are all required?
19:54 willthechill jnap: yes I'm here
19:54 willthechill optional in what way?
19:55 jnap ok
19:55 jnap like
19:55 jnap our hashref $properties = { foo => my integer $foo = 2 };
19:55 jnap you do
19:55 jnap my $object = Foo->new(foo=>3);
19:55 jnap and then $object->{foo}  == 3
19:55 jnap right?
19:56 jnap assuming that in the Foo package
19:56 jnap and I assume
19:56 willthechill no there is never anything inside new()
19:56 willthechill there is no new(foo=>3)
19:57 jnap how do we set property values then?
19:58 willthechill you already had it: $myobject->{foo_property} = 'some value';
19:58 willthechill also you can use accessors, although I tend not to do so because they slow things down for no reason
19:59 willthechill (yes yes I know it is against OO best practices, but speed is #1)
19:59 jnap ok so
20:00 jnap my object $foo = Foo->new;  then $foo->{foo} = 5
20:00 jnap I think we are going to need something with new that is closer to how Moose works
20:01 jnap if we are going to drop support for ->new(%args) then adding 'has' keyword isn't very useful
20:01 jnap at that point it would be best to rewrite the class in full on RPerl
20:02 jnap and just rewrite the attributes into properties
20:02 willthechill we never dropped support for anything, it was never there to begin with because RPerl is built from scratch
20:02 jnap hmm I wonder
20:02 willthechill if we need to add it, then fine, we simply add it
20:03 jnap maybe we could just have a filter than changes ->new(a=>1, b=>2) ==> $self->{a} = 1; $self->{b}=2
20:04 jnap or maybe easier to just add the bless keyword
20:04 jnap not sure leet me think for a moment
20:05 jnap oh, is there a way to test a value against a type
20:05 jnap something that returns yes/no rather than throws an exception?
20:29 jnap willthechill: ok so our hashref $properties = { foo => my integer $foo = 2 };
20:30 willthechill sorry busy coding
20:30 jnap that means $foo is an integer with a default of 2
20:30 jnap no problem :)
20:30 jnap I'm thinking is all
20:30 willthechill yes correct that is the default value
20:30 willthechill okay remember I am generally against filters and other non-grammar ways of parsing things
20:31 jnap yeah I get it
20:31 jnap too many errors
20:31 willthechill we need to upgrade the medium-magic RPerl grammar to support whatever it is that you want to go into skinny Moose
20:31 willthechill yes too many unknowable errors
20:32 jnap oh and $self->{foo} = 'string'  would throw an error because failed to match tmp, right?
20:32 jnap how hard would it be to support something like this
20:32 jnap our hashref $properties = { foo => my integer $foo = sub { 1+1 }  };
20:32 willthechill $self->{foo} = 'some_string' will throw a compile-time error when running in compiled mode
20:33 willthechill okay now you're starting to look a little crazy with your sub {1+1}  :-P
20:33 jnap I'm tying to figure out how to do moose lazy attributes
20:34 jnap I kinda think it would be needed.  so that would be a lot of work you think?
20:34 jnap I get to be crazy too
20:37 jnap think about it a bit, I'll write some more examples
20:43 willthechill oh lazy attributes, okay...  yeah we'll have to think about that
20:44 willthechill a lazy attribute should actually be called what it is... a runtime-evaluated method
20:44 willthechill attributes are pieces of data, not code blocks
20:44 willthechill attributes AKA properties
20:45 willthechill so I think we should somehow compile Perl lazy attributes into C++ methods
20:50 willthechill jnap asked: is there a way to check a value against a type without throwing an exception?
20:50 willthechill yes RPerl has a relatively robust type system
20:53 willthechill https://github.com/wbraswell/rperl/blob/master/lib/rperltypes.pm#L157-L221
20:53 willthechill RPerl system programmers may make use of the type() and types() subroutines
20:54 willthechill and those subs in turn make use of build_is_type(), which in turn calls main::RPerl_SvIOKp($variable) and friends, which in turn either hooks into the Perl C internals or calls the equivalent RPerl C code when not available in Perl core
20:54 willthechill so it is doing real C type checking for Perl types
20:54 willthechill REAL TYPES!  :-D  just one of the many reasons why RPerl is a REAL compiler haha ;-)
20:55 willthechill type() and types() are not really meant to be utilized by RPerl application developers, it is for RPerl system devs only at this point
20:58 jnap ok, I'll play with that
20:58 willthechill cool beans
20:58 jnap oh one more thing
20:58 jnap can a type be assign to a variable
20:59 willthechill no types are barewords only
20:59 jnap my type $info = integer
20:59 jnap or something like tht
20:59 willthechill none of that meta programming high-magic stuff
20:59 willthechill types are only types
20:59 willthechill types are not values or variables or subroutines, etc
20:59 jnap hmm
21:00 jnap 'k
21:03 willthechill we are generating C++, so types are just types like in normal C++
23:01 lizmat_ joined #perl11
23:19 willthechill joined #perl11

| Channels | #perl11 index | Today | | Search | Google Search | Plain-Text | summary