The Return of the Journal : pugs.blogs.com/ | pugscode.org | pugs.kwiki.org | paste: paste.lisp.org/new/perl6 or sial.org/pbot/perl6 Set by stevan on 23 December 2005. |
|||
svnbot6 | r8405 | luqui++ | Large, gut-mangling change to fix: | 00:44 | |
r8405 | luqui++ | my $a = [1,2,3]; my @b = $a; @b.elems # 3 | |||
r8405 | luqui++ | Incidentally, unary * works correctly now, too. | |||
luqui | ?msg svnbot6 ?check | 00:45 | |
svnbot6 | r8406 | luqui++ | P6GE now has captures, in their fully-specified glory. | ||
r8406 | luqui++ | Once backtracking controls are in, then it will be a complete combinator library for perl 6 rules! | |||
nothingmuch | luqui: please note to @Larry that your latest discussion, wrt rules reimplemented in perl 6 relates to circular prelude, etc | 00:54 | |
and that this is a very nice example of why it's so important to think of this early | |||
luqui | I guess so... | 00:55 | |
on the other hand, you can just think of the rules implementation as the beginning of the post-bootstrapping process for rules | 00:56 | ||
(not to say that PGE won't be used---it most definitely will, because my implementation is a dog) | |||
nothingmuch | well | 01:00 | |
the point is that there's a reference implementation for everything | 01:01 | ||
which gives us: | |||
a. something users can refer to in doubt | |||
(when the docs aren't good enogh) | |||
luqui has used that for Haskell a few times :-) | |||
nothingmuch | b. something slow, but that still works | ||
(very quick backend writing) | |||
c. something that allows each backend to implement what they really need to implement | |||
even in a profile oriented way | |||
implement an opcode | |||
profile your code | 01:02 | ||
luqui | I think the biggest block is the graph theory involved | ||
nothingmuch | see what the next opcode to add should be | ||
we can simplify it a bit | |||
make it non circular | |||
a bit more ad hoc | |||
or whatever | |||
no, make it circular | |||
luqui | uh... make the circular preluded noncircular? | ||
nothingmuch | no | ||
that was a brain fart | |||
luqui | I don't think you're going to get away from the graph theory... somebody just has to figure it out | 01:03 | |
it's probably related to a well-known algorithm | |||
nothingmuch | aye | ||
but I have no time to think of it right now | |||
job to demanding | |||
luqui | the JS backend is pissing me off | ||
nothingmuch | when my Catalyst stint ends, i'll get back to pugs land | ||
right now rewritten sessions and authen/authz are getting less problems | 01:04 | ||
better docs | |||
daily | |||
luqui | cool, understood | ||
nothingmuch | things are solidifying | ||
and after that I can just leave it to the community | |||
so anyway | |||
audreyt wonders if it's possible to lure nothingmuch to Jifty6 | 01:05 | ||
nothingmuch | Jifty6? | ||
audreyt | speculative idea of perl6 port of Jifty | ||
luqui | why the heck can't I use modules from JS?! | 01:06 | |
audreyt | Jifty is the thing I've switched from catalyst to for $job | ||
nothingmuch | what is Jifty? | ||
oh | |||
luqui | for some reason it's looking for the "Parse" module, even though I'm using "Parse::Rule::Combinators" | ||
audreyt | it was once known on my journal as "Bamboo" | ||
nothingmuch | i see only Jifty::DBI on CPAN | ||
is it still a layer on top of Catalyst et al? | 01:07 | ||
? | 01:08 | ||
obra | It's never had anything to do with cat | 01:09 | |
It comes out on XMAS | |||
Jifty::DBI is just the object-relational mapper we've got | |||
nothingmuch | what does it do differently? | 01:12 | |
audreyt | nothingmuch: it's this continuation-capable, page-region-based, scriptaculous-powered, declaratively-modelled, absolutely-no-sql-needed-for-schema-generation, REST-action-based, buzzword-compliant thing | ||
nothingmuch: I think mostly the idea of page regions, decomposition to REST actions, and web continuations, are quite different | 01:13 | ||
obra | It's also much more in the "one good way" than "everywhich way" camp than Catalyst. | 01:14 | |
audreyt | also, it has ajax_autocomplete, ajax_validate, ajax_link, ajax_tangent, ajax_everything that happens to degrade happily on w3m. | ||
obra | (autocomplete doesn't work in w3m ;) | ||
hm. | 01:15 | ||
it could. | |||
audreyt | I did say "degrade" :) | ||
and it could. | |||
however, its default presentation layer library is really primitive (the same level as Catalyst's default Scaffold); it can definitely be improved | 01:16 | ||
nothingmuch | hmm | ||
sounds cool | |||
i don't have anything to do webapp wise in the short term future though | 01:17 | ||
so my answer is no ;-) | |||
audreyt | that's fine :) | ||
obra | audreyt: yes. the presentation-layer library wants love. lots of love. | ||
also a coherent theory behind it | 01:18 | ||
audreyt | and also it probably wouldn't hurt to adopt catalyst-style attribute based controller | ||
justatheory clears his throat | |||
audreyt | if not as a default, certainly as an option | ||
to avoid dhandler overflow | |||
obra | attribute-based controller? | ||
justatheory: when are you releasing your web framework? | 01:19 | ||
audreyt | sub details : Regex('^product/(\w+)/details$') { | ||
.... | |||
} | |||
obra | ah. *nod* | ||
I sort of wonder if a dispatch table is a better answer than that. | |||
at least to fit with the jifty model. | 01:20 | ||
audreyt | well, but it is a dispatch table :) | ||
justatheory | obra: No idea. Will probably launch some apps first. | ||
Hopefully in 2006, though. | |||
obra | sorry. but _just_ a dispatch table. | ||
audreyt | ah. hm. | ||
obra | how many apps do you have in the pipeline? | ||
audreyt | maybe. I have no idea. have to experiment | ||
obra | audreyt: nod. | ||
justatheory | obra: One at th emo. | ||
audreyt | but that's one single thing I miss from Cat. | ||
obra | agree that we want it. | ||
*nod* I don't like the dhandler game | |||
nothingmuch | okay, i'm off to bed | 01:21 | |
also, i must warn you guys | |||
the reason i like catalyst is it's complete lack of one-good-way | 01:22 | ||
obra | it'll get a lot easier when we get a working mason plugin. | ||
audreyt | nothingmuch: indeed, that's what I liked -- and still like -- about perl5 as well | ||
nothingmuch | because that makes flexibility be thought out very hard in advanced | ||
*advance | |||
audreyt | but sometimes it doesn't hurt to experiment with bright white castels :) | 01:23 | |
nothingmuch | anyway, i'll take a long hard look at Jifty when it's out, and i'm doing web stuff again | ||
audreyt | castles, even | ||
nothingmuch | *yawn* | ||
shit, i wanted to bike tomorrow morning | |||
luqui | audreyt, do you think Parse::Rule should do its own rule parsing, or should it just provide combinators for the perl 6 parser to call? | ||
nothingmuch | luqui: two layers | ||
luqui | nothingmuch, clearly | ||
audreyt | luqui: Parse::Rule::Parse::Rule | ||
luqui | :-) | 01:24 | |
nothingmuch | luqui: i mean, two modules | ||
luqui | I was just wondering if the top layer was even necessary. Like lemon meringue without the meringue | ||
nothingmuch | make them pluggable | ||
and then make them easy | |||
anyway, i'm off | |||
audreyt | luqui: you can do the pmichaud thing and use a precedence parser frontend that has no concre te syntax | 01:25 | |
and bootstrap rule parsing from there | |||
luqui | yeah, I figured. So the answer is "yes you should do your own parsing" | 01:26 | |
It kinda makes sense if we want perl 6 to be self-hosting | |||
something's got to parse the grammar spec | |||
audreyt | *nod* | 01:30 | |
porting 323 lines of PIR | |||
probably isn't that difficult | 01:31 | ||
luqui | right | ||
svnbot6 | r8407 | luqui++ | Added test for [ [ x ]* ]* infinite loop, and made it pass. | 01:35 | |
luqui | there, now I'm officially better than PGE ;-) | ||
audreyt | rofl | 01:36 | |
hm, I wonder how long it can take to port that 323 lines to Hs | 01:37 | ||
audreyt goes trying | |||
luqui | why? | ||
audreyt | for fun, mostly | 01:38 | |
luqui | ah. I wrote a regex engine in like 30 lines of Hs using the list monad | ||
audreyt | also parsec doesn't handle circumfix cleanly | ||
luqui | to try out my approach... | ||
luqui noticed with sadness that you couldn't define circumfix operators | 01:40 | ||
audreyt | why? | 01:42 | |
luqui | er, in pugs | ||
audreyt | er, that's another reason to write Text.Parser.OPTable now | ||
luqui | makes sense | 01:43 | |
audreyt | parsec can emulate bottom up, but it's not going to be fast | ||
in fact that's one of the slowest parts | |||
luqui | really? how strange | ||
audreyt | due to a lot of shifting in circumfix/postcircumfix | ||
currently we dynamically construct an prec parser every time we enter BEGIN | 01:44 | ||
and cache it inside the parser | |||
which does speed up things | |||
but I'd like something less dependent on unsafePerformEval | |||
luqui | aye | ||
well, I guess we'll all be writing OPTable at the same time then | 01:45 | ||
audreyt | it's a race! | ||
luqui | however, I have to sleep now. | ||
oh darn, I'll lose | |||
stupid sleep | |||
audreyt | :) | ||
good night, sleep well | |||
if I manage to pull it off, you'll probably have a much easier time porting it to p6 | |||
luqui | because it's possible to read haskell? | ||
audreyt | sir, you are really mean when you're sleepy :) | 01:46 | |
luqui | what? | ||
audreyt | just go sleeping already | ||
luqui | oh, mean towards PIR. but it deserves it. :-) | ||
mwahaha | |||
sayonara | 01:47 | ||
audreyt | (yes, because haskell makes algorithm flow more explicit. but no, I don't think PIR is impossible to read) | ||
luqui & | |||
yeah, but you're audrey | |||
luqui fg;bg | |||
oh, audreyt, one more thing | 01:54 | ||
how is pugs's support for continuations these days | |||
audreyt | luqui: limited to coroutines and nonreentrant &?CALLER_CONTINUATION | 01:57 | |
again, the new runcore is designed with full serializable continuations | 01:58 | ||
luqui | ooh, serializable... shiny | ||
using continuations, Parse::Rule could be made quite a bit more readable | |||
audreyt | but the JS core is fully resumable in $?CALLER_CONTINUATION | 01:59 | |
luqui | but I'll wait on the new runcore to convert it to that | ||
audreyt | oh? you can't just use exceptions? | ||
try { die $obj } | |||
luqui | hmm | ||
audreyt | because you the throw out whole coros or closures, that's sometimes easier than continuations | ||
(sometimes it's even easier just to code things as coro, as parrot hackers seem prone to do) | |||
luqui | I tried as coro | 02:00 | |
lots of repetition | |||
I ended up explicitly looping over results way too much | |||
CPS was a good fit | |||
but explicit CPS is inherently hard to read | |||
(on the plus side, It can be transliterated easily to perl 5 with the current implementation) | 02:01 | ||
anyway, off to bed | |||
luqui & | |||
avar | fg | ||
audreyt | strangely I've got the API implemented in no time | 02:03 | |
now to implement the shift/reduce rules... | |||
dduncan | commit pending ... | 02:18 | |
stevan | audreyt: ping | ||
dduncan | done | 02:22 | |
svnbot6 | r8408 | Darren_Duncan++ | r1549@Darren-Duncans-Computer: darrenduncan | 2005-12-23 18:20:09 -0800 | ||
r8408 | Darren_Duncan++ | /ext/Rosetta-Incubator : in Language.pod, rewrote the 'Native Primitive Types' section, particularly about numeric types, and edited some other parts | |||
dduncan | I did a fair amount of thinking about that numerics stuff ... feedback appreciated | ||
considering I tend to buck the trend's there that I know about | 02:23 | ||
stevan | obra: re: Jifty, how are you doing continuations? Coro? something else? | 02:24 | |
obra | we're doing app-level continuations. | 02:25 | |
"We're faking it" | |||
stevan | ah | ||
fake it until you make it :) | |||
obra | but, it seems to work pretty well | ||
stevan | is Jifty public yet? | ||
audreyt | managing one's own heap is definitely the way to go | ||
obra | Sunday | ||
audreyt | if you control both the controller _and_ the presentation | ||
stevan | excellent | ||
obra | audreyt: we should talk some time about gc strategies for continuations | 02:26 | |
stevan has to find a new web framework & ORM solution for $work | |||
audreyt | obra: I still advocate stashing it all to the webpage | ||
obra: zero gc on server side | |||
stevan | $client is not into the ide of using ruby | ||
audreyt | obra: so, SHA1_HMAC | ||
obra | audreyt: chmrr had some good reasons not to do that | 02:27 | |
stevan: how soon? | |||
audreyt | obra: I'd like to hear them | ||
obra | audreyt: after sunday morning ;) | ||
but yeah, I'd like you and him to debate it. | |||
:) | |||
stevan | obra: well, the current project ends Feb. 1, and we need to decide what to use before the next project (around March) | ||
obra | ok. so not a need-a-test-release-cut-tonight | 02:28 | |
stevan | not at all :) | ||
obra | cool | 02:29 | |
dduncan | fyi, from my reading, the term ORM is a bit of a misnomer | 02:30 | |
considering that many objects are essentially just multi-part types | |||
and the plain relational model allows for those | |||
stevan | dduncan: I agree, but its recognizable :) | ||
dduncan | sure | ||
obra | it maps from Objects into a Relational Database | 02:31 | |
dduncan | but I'm just pointing out that people mention object-relational as if it were different from relational | ||
whereas plain-relational supports objects | |||
obra | In standard use, has nothing to do with an object-relational database | ||
it's talking about first-class in-your-language objects | |||
avar | dduncan: doesn't ORM refer to stuff like defining a table as extending the definition of another table? | 02:32 | |
dduncan | of course, the relational model was designed to be embedded in another programming language, rather than being something separate | ||
the relational model says that you have sets which are related to other sets | |||
it provides common ways of organizing and processing those | |||
its loosely like how Perl has hashes as a first class variable type | 02:33 | ||
a relation is like a hash where the key is multi-valued, and there is no hash value | |||
and all hash keys have the same number and type of values | 02:34 | ||
so one hash key is a tuple | |||
the whole hash is a relation | |||
of course, that assumes no duplicates allowed or undefs/nulls | |||
a multiset is like a relation but that you use the hash value to count occurances where the key occurs in the set more than once | 02:35 | ||
adding nulls complicates things | |||
put another way, | 02:36 | ||
a relation is like a junction of array refs, where each array has the same number of elements | |||
and corresponding elements are of the same type | |||
I'm not sure if Perl supports junctions of array refs, though | 02:37 | ||
oh yes | |||
and each array element / hash key part can be arbitrarily complex type | |||
either a scalar or multi-part object | 02:38 | ||
audreyt | stevan: er, sorry, pong. | 02:40 | |
stevan | audreyt: :) | ||
did you see my ramblings earlier | |||
the new infix ops dont work since there is no send defined (at least not one I or ./pil could find) | 02:41 | ||
audreyt | $ ./pil -e '1`add(3)' | ||
4 | |||
stevan | :/ | ||
lemme svk up again | |||
everything still works though,.. | 02:42 | ||
Bootstrap.pil still compiles and the tests pass | 02:43 | ||
is that intentional? | |||
do_if, do_for, etc are not subject to this right? | |||
audreyt | currently .send just dispatch to ` if it's not userdefined | 02:45 | |
stevan | audreyt: ./pil -e '::Class`is_nil`cond(-> { true }, -> { false });' | ||
audreyt | so it's operationally the same | ||
stevan | I am sorry... I didnt look deep enough,.. that last bit fails | 02:46 | |
other ones work | |||
but it seems it fails when chained | |||
audreyt | fixed | 02:47 | |
stevan | :) | ||
audreyt | brb | ||
stevan resumes reasing about R/OM while he waits for svnbot | |||
svnbot6 | r8409 | audreyt++ | * allow chained `method calls. | 02:49 | |
obra | R/OM? | 02:55 | |
stevan | obra: this article www.onjava.com/lpt/a/6366 | ||
it is an interesting point of view on the idea | |||
basically the idea is that in some cases,.. the R should lead the O | 02:56 | ||
where most ORM tools (especially Java ones) force the other way around | |||
audreyt: the null instance now is ::`new_opaque({}) | 02:57 | ||
I kinda like that | |||
r0nny | yo | 03:01 | |
howz the state of the object system atm ? | |||
stevan | r0nny: if you dont need imperitive features like assignment and loops,.. it is pretty good :) | ||
r0nny: we have the entire class system, and a slightly broken (but usable) role system, and the foundation of the boxed type system | 03:02 | ||
dduncan | stevan, that article has good ideas | ||
stevan | but it is all still in PIL | ||
dduncan: yes, i think so too,.. it is particularly applicable to the work I do, where the data model really should lead | 03:03 | ||
r0nny | n8 then, and marry christmas | ||
stevan | r0nny: same to you :) | 03:04 | |
dduncan | its certainly safer for the data model to lead, since that lets the database do what it's good at, and helps make the data safer | ||
stevan | dduncan: yes, and it helps in seperating responsibilties too,.. if the DBA owns the database, rather than maintains the mess the ORM system created,.. he/she is more likely to be happy | 03:05 | |
stevan has decided that he is a really really *really* bad DBA, and should never be trusted with control of anything but a really simple schema | 03:06 | ||
so $coworker is now in charge of it since he is a good DBA | 03:07 | ||
audreyt: I have just converted everything to use ` and . appropriately, and I am running the tests to make sure all is well | 03:09 | ||
if all goes well, can we make it so that ` and . /only/ work for prims and user-defined respectively? | 03:10 | ||
I would like to make sure there is nothing I missed which might bit me later | 03:11 | ||
svnbot6 | r8410 | audreyt++ | * Text.Parser.OpTable -- Haskell port of PGE::OPTable. | 03:19 | |
r8410 | audreyt++ | All data structures and APIs are there; need to fill in | |||
r8410 | audreyt++ | implementation now, but it should help luqui++ a lot already :) | |||
audreyt | yes | 03:28 | |
what about ! | |||
does it not consult MRO? | |||
stevan | no, that should | ||
it is for user defined private methods right? | |||
audreyt | yes | ||
my method foo | 03:29 | ||
stevan | yes, that doesnt use the MRO anyway | ||
it consults the current class, if it doesnt find the method,.. it fails | |||
sorry,.. (re-reading previous statements),... ! should *not* consult MRO | 03:30 | ||
audreyt | good, then we are still on the same page | ||
stevan | no ;) | 03:32 | |
audreyt | oh? ;) | ||
stevan | ok, you convinced me | ||
audreyt | heh :p | 03:33 | |
do you think $closure`() is hard to type? should we introduce sugar $closure() ? | |||
audreyt feels like a sugar dealer in the past week or so | 03:34 | ||
stevan | well, if we did $closure(), then we need to do -> { }do_if(...) | 03:35 | |
to keep things consistent | |||
audreyt | no, it's just for `() | ||
stevan | or, we can do $closure() and -> { }`do_if(...) | ||
audreyt | yeah | ||
but then $closure.() will mean different things as $closure() | |||
stevan | hmm | 03:36 | |
maybe it should be $closure`() then | |||
audreyt | k | ||
stevan | I think you and I will likely be the only ones ever writing this anyway (at least for the forseeable future) | ||
audreyt | yup | 03:37 | |
let me finish OpTable.addToken first | 03:40 | ||
pmichaud's clever algorithm is a bit too clever | |||
I'm not sure if it is actually correct on precedence handling | |||
stevan | ok, take your time,.. I need to think/read about roles anyway | ||
stevan wanders over to Scala | 03:41 | ||
audreyt | fwiw, while our dynamic side calculus resembles YARV, I'd like the static side to resemble vObj/lambdaCube | 03:43 | |
(vObj is what Scala uses internally) | 03:44 | ||
they have this new self-hosting compiler for Scala written in Scala that I kept meaning to check out but didn't got the timeslice | |||
stevan | do you have links for vObj lambdaCude papers? | 03:45 | |
stevan needs to just get an ACM membership so he can read all the good papers | 03:46 | ||
audreyt | all vObj papers are in scala.epfl.ch/docu/related.html | ||
one implementation of lambda cube is in Jhc's "data E" type: | 03:48 | ||
repetae.net/john/repos/jhc/E/E.hs | |||
lambda cube related papers: www.cs.ru.nl/~henk/papers.html | 03:49 | ||
Jhc's take on reified types: repetae.net/john/computer/jhc/jhc-r...class.html | |||
stevan | which paper is most relelvant to Lambda Cude | 03:50 | |
audreyt | well... as usual we turn to the great educator SPJ | 03:51 | |
research.microsoft.com/~simonpj/Pap...henk.ps.gz | |||
azuroth | test | 03:53 | |
audreyt | stevan: henk is coauthored by emeijer, who brought much of the type calculus to VB's soft typing which I hope to emulate | 04:08 | |
stevan | ok | ||
this stuff is a little over my head,.,. but I will attempt to grok as best I can (well at least the vObj stuff so far) | 04:09 | ||
audreyt | I suggest you focus on vObj for 6.28.0 :) | ||
we won't need \Cube until 6.2813 | 04:10 | ||
stevan | ok | ||
can you explain "dependent types",.. I am confused by the term | |||
audreyt | ok | ||
stevan | the "nominality" stuff sounds similar to @Larrys "class but undef" thing | 04:13 | |
audreyt | normally we have functions, which is a term whose value depend on other terms | 04:14 | |
then we also have higher-rank types like "Hash of ::t", which is a type that depend on other types | |||
stevan | ah | 04:15 | |
ok, this makes sense then in the context they are talking about | |||
audreyt | there are also term depending on types, which is typecasing | ||
stevan | they are talking about the SML module system... where stuff like that is easy to express | ||
audreyt | or compile-time ref() | ||
so far so good? | |||
stevan | so far so good | 04:16 | |
typecasing or typecasting? | |||
audreyt | typecasing... think want() | ||
stevan | ok | ||
audreyt | which is a term whose value depending on the (return) type | ||
finally we come to dependent types | |||
which is a type that depends on terms | |||
for example, the "n-Tuple" type | 04:17 | ||
depends on a concrete value "n" | |||
stevan | Hash of foo()? where foo() returns some kind of type? | ||
audreyt | think shape() | ||
:shape, even | 04:18 | ||
stevan | ok | ||
SML functors come to mind | |||
types which depend on types whose value may not be known at that moment | |||
am I on the right track? or smoking crack? | 04:19 | ||
audreyt | that's still tyop | ||
type operator | |||
you have to depend on some concrete runtime term's value | |||
it's not expressible in ordinary ML or Haskell98 | |||
arrayOfThreeInts :: Array 3 Int | 04:20 | ||
here the "3" is not a type, but a normal term (literal value) | |||
that's a dependent type | |||
stevan | oh | 04:21 | |
hmmm | |||
how is this useful? is there a real world context for this? | |||
audreyt | is arrays of three ints not useful? | ||
boundedNumber :: IntBetween 3 4 | |||
stevan | ok | 04:22 | |
audreyt | with GADTs haskell gains the ability to express dependent types | ||
stevan | now I am thinking about Ada subtypes | ||
audreyt | yes, but does Ada check them at compile time, or are they all turned into assertions? | ||
stevan | I think Ada checks at compile time,.. but thats because it's Ada, and planes are better left in the sky :) | 04:23 | |
audreyt | also, bounds are easy... what's harder is | ||
stevan | but conceptually it is helping me make the leap | ||
audreyt | n = 4 | ||
foo = 2 :: IntBetween 1 n | |||
or even | |||
makeFoo n = 2 :: IntBetween 1 n | 04:24 | ||
in perl6: | |||
stevan | so runtime type construction? | ||
audreyt | sub makeFoo ($n) { my Int where { 1..$n} $x = 2 } | ||
yeah | |||
stevan | oh | ||
very cool | |||
audreyt | yup, very cool. | 04:25 | |
I think it's definitely 1)useful 2)sexy 3)finally somwhat understood | |||
stevan | what would the return value of that p6 function be? | ||
audreyt | it will be 2 | ||
unless $n is < 2 | |||
where it is an error | 04:26 | ||
stevan | ok | ||
audreyt | and presumably you can check it at compile time if you see makeFoo(0). | ||
stevan | but it seems that this brings the power of compile time type-checking to runtime | ||
or does it bring the flexibility of runtime to compile time (where it can be checked)? | 04:27 | ||
audreyt | both. | 04:28 | |
it... blurs the boundary between runtime and compile time. | |||
stevan | even better :) | ||
audreyt | which perl has been doing (very crudely and dangerously) for ages. | ||
stevan | yes | 04:29 | |
I see why this is important for us | |||
audreyt | and now there's finally some light in formalizing this :) | ||
stevan | one more questions | 04:35 | |
when they say in the vObj paper ... "objects and classes with type members"... they mean the object has attributes which are types? | 04:36 | ||
audreyt | yes. | 04:39 | |
stevan | like inner classes? | ||
class Foo { has Class $.bar = Class.new(name => 'Bar'); } | 04:40 | ||
audreyt | something like that, yes | ||
stevan | or maybe | ||
class Foo { my class Bar { } } | |||
audreyt | aye | 04:42 | |
stevan | class Foo[::T] { my class Bar is ::T { } } | 04:43 | |
would that be a "dependent type"? | |||
since the value of T would be deferred until later in the program | 04:44 | ||
audreyt | well, if all this happens at compile time, no, that's just a type operator | 04:45 | |
a type depending on type | |||
class Foo[&f] { ... } | |||
is another matter | 04:46 | ||
stevan | my $foo = new Foo[@ARGV[0]] :P | ||
audreyt | now, allowing that syntax makes it effectively dependent typing, yes. | ||
stevan | how would &f be used in the body of Foo? | ||
audreyt | it would presumably be invoked. | 04:47 | |
stevan | and its return value be used in a type annotation/definition? | ||
audreyt | presumably, yes. it's not really p6, just for illustration | 04:49 | |
I'll brb | |||
stevan | ok | ||
stevan sleep & | 05:08 | ||
asavige | anybody there to answer my dumbass p6 questions? | 05:24 | |
azuroth | I'll give it a go, if they actually are dumbass :-) | 05:26 | |
asavige | ok, thanks i've got @lol = ( [ '1a', '1b' ], [ '2a', '2b' ] ); | ||
now I want to iterate for @lol -> $t { say "1st='$t[0]' 2nd='$t[1]'" } works | 05:27 | ||
but i want to write: for @log -> $x, $y but I don't know how to flatten | |||
05:28
wolv is now known as wolverian
|
|||
dduncan | yes, "Laugh Out Loud" sounds like typically dumbass conversation :) | 05:29 | |
azuroth | ?eval my @a = (['1a','1b'],['2a','2b']); for @a -> [$x,$y] { say $x ~ $y; }; | ||
05:29
evalbot_8404 is now known as evalbot_8410
|
|||
evalbot_8410 | Error: unexpected "f" expecting ";", statements or end of input reserved word | 05:29 | |
azuroth | ?eval my @a = (['1a','1b'],['2a','2b']); for @a -> $x,$y { say $x ~ $y; }; | ||
evalbot_8410 | OUTPUT[1a 1b2a 2b ] undef | ||
azuroth | ?eval my @a = (['1a','1b'],['2a','2b']); for *@a -> $x,$y { say $x ~ $y; }; | 05:30 | |
evalbot_8410 | OUTPUT[1a 1b2a 2b ] undef | ||
azuroth | hmm. sorry, I've got no idea | ||
asavige | azuroth: thanks (I groped around with those variations too;-) | 05:32 | |
azuroth | that's alright. I'm gonna try installing nvidia drivers, brb! | 05:33 | |
svnbot6 | r8411 | audreyt++ | * Text.Parser.OpTable: addToken fully implemented. that's 50% of the functions... | 06:17 | |
r8412 | audreyt++ | * Text.Parser.OpTable: Helper classes to construct optables easily | 06:59 | ||
obra | having fun, audreyt | 07:04 | |
audreyt | yeah, cloning PGE. | 07:07 | |
almost there now. | |||
(the shift/reduce part; the full grammar part is luqui's job) | |||
bbiab & | 07:14 | ||
svnbot6 | r8413 | audreyt++ | * Text.Parser.OpTable: DynStr node, which covers callbacks | ||
r8413 | audreyt++ | to PGE::Match and other callback-code nodes. | |||
obra | Next task: implement PGE in Sendmail.cf | 07:17 | |
dduncan | question: | 07:59 | |
svnbot6 | r8414 | asavige++ | added some more split tests | ||
dduncan | what is the perl 5 equivalent of aliasing a lexical variable from another, like := does in perl 6? | 08:00 | |
a bit of experimenting I tried with '\' and '*' didn't seem to work | |||
perhaps the * only works on globals | |||
'*' meaning glob | 08:01 | ||
asavige | dduncan: S2 says "typeglobs are gone. Use binding (:= or ::=) to do aliasing" | 08:06 | |
typeglobs don't work on lexicals though | |||
dduncan | yes | ||
but I'm trying to make some perl 5 code act like perl 6 | 08:07 | ||
in perl 6, I can say %foo := %bar | |||
what is the perl 5 equivalent of that? | |||
and note that %foo and %bar are both lexicals, declared with 'my' | |||
asavige | k. sorry, don't know how to do aliasing on lexicals | ||
dduncan | specifically, I want to do something like this: my %hash; \%hash = $hash_ref; | 08:11 | |
buu | dduncan: Tie, generally. | ||
dduncan: Or scary glob vooodooo | |||
dduncan | if anyone else knows, glad tohear it | ||
buu | try | ||
dduncan | yes, what is the scary glob vodoo? | ||
buu | eval: %h1 = qw/foo bar/; *h2=*h1; $h2{foo} | 08:12 | |
dduncan | it seems that *foo = \$bar doesn't work | ||
buu pokes eval | |||
oh | |||
dduncan | that may only work for globals | ||
buu | eval: %h1 = qw/foo bar/; *h2=*h1; $h2{foo} | ||
p5evalbot | buu: Return: bar | ||
buu | eval: %h1 = qw/foo bar/; *h2=*h1; $h2{foo}='wtf'; $h1{foo} | ||
p5evalbot | buu: Return: wtf | ||
buu | You can make pseudo lexical globs with local. | 08:13 | |
Obviously you can't refer to the globs of lexicals. | |||
asavige | maybe look at Lexical::Alias on CPAN by Japhy? | ||
integral | lexicals don't have globs. There's also Data::Alias | ||
dduncan | my situation is that I'm trying to emulate 'trusts' in perl 5 | ||
jdv79 | trusts? | ||
dduncan | I have a function that exports \%foo from one package, and that func is called by the other | ||
what the func returns is a hash-ref | 08:14 | ||
I want a lexical hash in the calling package to point to what the hash-ref does | |||
buu | Abuse tie. | ||
It's fun and profitable! | |||
integral | I think you'll have to | ||
dduncan | it should be a non-tie solution | ||
buu | Too bad.; | ||
dduncan | I was hoping some simple symbol manip would work | 08:15 | |
buu | Obviously symbol manipulation works. /me points upwards | ||
integral | not for lexicals. there's no symbol to manip unfortunately. But PadWalker, Lexical::Alias, Data::Alias might help | ||
dduncan | I'll look up the Lexical::Alias | ||
asavige | Lexical::Alias is done at XS level | 08:17 | |
jdv79 | are we there yet? | ||
buu | Yes. | ||
dduncan | oh ... don't want to use xs | 08:18 | |
buu aliases here to there. | |||
You are whiny. | |||
integral | dduncan: umm, you'll have to... | ||
jdv79 | the man knows what he wants and he wants it now! | ||
:) | |||
buu | Data::Alias doesn't seem to have xs | ||
Oh wait, I lie | 08:19 | ||
dduncan | if I can't find a solution, then at least I have the workaround of using the $hash_ref->{foo} instead of $hash{foo} | ||
buu | It's there at the top. | ||
dduncan: Yes.. workaround.. | |||
dduncan | but I wanted to try something new, make the code look nicer | ||
buu | dduncan: What earthly reason do you have to be so picky? | ||
dduncan | making similar-acting code look similar | 08:20 | |
its just a preference | |||
buu | dduncan: So about my question? | ||
dduncan | will look at data::alias | ||
I wanted to do this aliasing thing as a style preference | 08:21 | ||
buu | So use tie | ||
Where's the problem? | |||
dduncan | the problem was that I wanted it to be simple, more importantly | 08:22 | |
if its not as simple as $hash_ref, I'll just use $hash_ref | |||
buu | Uh | ||
tie %x,$y; $x{y} | 08:23 | ||
dduncan | is that all that's necessary? | ||
buu | Yes | ||
dduncan | I thought I had to declare accessors | ||
buu | Well, yes, in the module. | ||
But the using code is clean. | |||
Tie actually needs a third argument. | |||
dduncan | thank you for your help | 08:24 | |
buu | Hrm. sub FETCH { $self->{$_[0]} } | ||
dduncan | okay, commit pending ... | 08:59 | |
... delayed ... have to find my password again ... | 09:08 | ||
azuroth | tell me when you find it | 09:11 | |
dduncan | I just have to so rarely enter it ... don't know why I'm being prompted now of all times | 09:12 | |
oh, that's why | |||
the server's down | |||
azuroth | yeah, auto-remember password things always end in disaster | 09:13 | |
dduncan | audreyt, it appears that the svn service is down, but the physical server's up, so maybe you can fix it remotely? | ||
well, the perl 5 version is committed to utsl anyway ... the perl 6 version will have to wait until tomorrow, unless the server's back up shortly | 09:18 | ||
luqui | buu, somebody had to tell him :-) | 11:56 | |
?eval my %hash = (a => 1, b => 2); my $h = { %hash }; $h.perl | 12:37 | ||
12:37
evalbot_8410 is now known as evalbot_8414
|
|||
evalbot_8414 | "\\sub \{...}" | 12:37 | |
luqui | ?eval my %hash = (a => 1, b => 2); my $h = { b => 2, c => 3 }; $h.perl | ||
evalbot_8414 | "\{(\"b\" => 2), (\"c\" => 3)}" | ||
luqui | Umm..... why can't I commit? | 13:01 | |
azuroth | dduncan was saying earlier that svn is down, even though the server is up | 13:02 | |
luqui | I can update... | ||
but the openfoundry webpage is giving me internal server error | |||
so maybe their auth database is causing problems | |||
good think I have svk ;-) | |||
azuroth | hmm, yeah | 13:03 | |
luqui | s/k/g/ | ||
?eval sub hr() { { a => 1, b => 2 } } hr.{'a'} | 13:23 | ||
evalbot_8414 | \undef | ||
luqui | ?eval sub hr() { { a => 1, b => 2 } } hr{'a'} | ||
evalbot_8414 | \1 | ||
luqui | ?eval sub hr() { { a => 1, b => 2 } } hr .{'a'} | ||
evalbot_8414 | \undef | ||
Mahmoud | hi | 14:41 | |
luqui | hola | 14:43 | |
Mahmoud | what is perl six | 14:47 | |
luqui | do you know what perl 5 is ? | ||
Mahmoud | a scripting language | 14:48 | |
compiled and interporated language | 14:49 | ||
i already use perl five but i head a lot about perl six.. but too lasy to read all what was said | |||
luqui | perl 6 is the next version of perl the language | ||
okay | |||
you can play with it in here: | |||
Mahmoud | it will be like a new language right? | ||
luqui | ?eval say "hello, world" | ||
evalbot_8414 | OUTPUT[hello, world ] bool::true | ||
luqui | yeah, pretty much | ||
Mahmoud | close to c and c++? | 14:50 | |
luqui | uh.... farther than perl 5 was | ||
azuroth | ?eval my @a = (1, 2, 3, 4, 5); @a >>+<< (5, 3); | ||
evalbot_8414 | (6, 5, 3, 4, 5) | ||
Mahmoud | wtf? | ||
luqui | azuroth, don't scare him right of the bat, geez | ||
azuroth | sorry. I think it's cool | ||
luqui | j/k | 14:51 | |
Mahmoud | perl six will be better for OOP? | ||
luqui | yep | ||
Mahmoud | but little slower and more resources needed? | ||
azuroth | ?eval my @a = (1, 2, 3, 4, 5); @a >>*<< 2; # double all | ||
evalbot_8414 | (2, 4, 6, 8, 10) | ||
luqui | ?eval class Foo { has $.bar; method say_bar() { say $.bar } } my $foo = Foo.new(bar => 4); $foo.say_bar() | ||
evalbot_8414 | OUTPUT[4 ] bool::true | ||
Mahmoud | print "foo"; | ||
?eval print "foo"; | 14:52 | ||
evalbot_8414 | OUTPUT[foo] bool::true | ||
luqui | Mahmoud, at the moment it's a lot slower | ||
azuroth | hopefully not, Mahmoud! parrot's our dedicated VM, and it's pretty fast | ||
Mahmoud | why there is no ';' at the end? canceled? | ||
luqui | but the current implementation is just a bootstrap | ||
the idea is that it will be faster, because it will be more aggressively compiled | |||
Mahmoud | ?eval my $var; | 14:53 | |
evalbot_8414 | undef | ||
luqui | (but that may be a dream given all the new features. I imagine it will end up being about the same speed overall) | ||
Mahmoud | i think OOP is always slower | ||
just like C and CPP.. | |||
luqui | well, Perl 5 had OO | ||
it was just a pain to use | |||
Mahmoud | C has OO too | ||
i should not talk about OOP.. | 14:54 | ||
luqui | it's really more about the style of programming when you're in an OO language | ||
azuroth | s/has/can do/ ? | ||
Mahmoud | i didn't do it with perl | ||
will they include multi line comments? | |||
c style comments | |||
luqui | heh, no | ||
but there's always POD | |||
Mahmoud | ?eval #comment | ||
evalbot_8414 | undef | ||
Mahmoud | larry wall hates c style comments for personal reasons | 14:55 | |
luqui | yeah. I don't recall the argument | ||
Mahmoud | any reason? | ||
luqui | yeah, he had some reasons, and they weren't that bad | ||
Mahmoud | i read something like 'c guys don't use it so much so why would perl guys use it?' | ||
luqui | you could write to [email@hidden.address] and ask | 14:56 | |
Mahmoud | i'm afraid from perl six... it may kill the language and no one write on it | ||
luqui | yeah, that's a common fear | ||
Mahmoud | just like why people use ASP, because it's easy and lots of programmers know it | ||
luqui | but perl is losing ground as it is to python, ruby, and php | 14:57 | |
people don't seem to have a problem learning new languages | |||
Mahmoud | losing ground? explain? | ||
luqui | a lot of perl programmers are using those languages instead because they're better at certain things | ||
python looks cleaner to many people, ruby is better at OO, and php is better for quick web stuff | 14:58 | ||
Mahmoud | php is faster than perl with mod_perl? | ||
luqui | you know, that ends up not mattering very much | ||
well, faster for the programmer | 14:59 | ||
not necessarily for the web server | |||
Mahmoud | coding in php is faster? | ||
luqui | uh huh | ||
coding web sites, that is | |||
Mahmoud | because of embeding php in the html you mean? | ||
luqui | yeah. it has a high "whipupitude" | ||
azuroth | heheh. | 15:00 | |
Mahmoud | it think it makes it faster for the server side too.. no? | ||
luqui | with perl you have to put something in cgi-bin, know about modules, etc. | ||
Mahmoud, whatever | |||
maybe, maybe not | |||
Mahmoud | the server doesn't send any thing to mod_php unless it sees <? | ||
luqui | that's not what's important to people, even though they think it is | ||
php is certainly not faster than Mason | 15:01 | ||
Mahmoud | i use mod_perl by extention | ||
luqui | but Mason is a bitch to use, so people use php instead | ||
azuroth | mason? | ||
Mahmoud | < files *.pl> directive in my httpd.conf for perl-script | ||
luqui | azuroth, it's a Perl 5 web templating module | ||
azuroth | ahh | ||
Mahmoud | i hate the idea of embeding perl/php/xxx with html.. better to use template engines | ||
luqui | yeah, experienced programmers think that way | 15:02 | |
Mahmoud | thanks :P | ||
luqui | but there are many unexperienced programmers for whom templating engines are crap | ||
and it's easier to embed code in html | |||
Mahmoud | for quick and dirty tasks it's better to not use template | ||
saving time | 15:03 | ||
i think we were talking about perl six | |||
luqui | ah yes | ||
well, that's why we want to make perl 6 | |||
Mahmoud | ?eval print "foo"; | 15:04 | |
evalbot_8414 | OUTPUT[foo] bool::true | ||
Mahmoud | OMG.. | ||
shoult it be capital OUTPUT? | |||
luqui | that's just the evalbot | ||
if you did it on the console, it would be what you expect | |||
Mahmoud | i thought evalbot is a perl five to perl six convertor | ||
luqui | oh, no | ||
audreyt | that would be nice | ||
luqui | it's a perl 6 evaluator | ||
Mahmoud | heh.. | ||
audreyt | but no it is not | ||
Mahmoud | how would i say print "foo"; in perl six? | 15:05 | |
luqui | print "foo" | ||
audreyt | you say | ||
integral | ?eval say "foo" | ||
evalbot_8414 | OUTPUT[foo ] bool::true | ||
audreyt | print "foo" | ||
Mahmoud | no ;? | ||
audreyt | well, if you like semicolon, you can add that | ||
just like in perl 5. | |||
luqui | they're optional on the last statement, just like in perl 5 | ||
I'm hearing an echo | |||
except it's coming before me | |||
Mahmoud | how does perl divide statements if no ;s are used? | ||
audreyt | it's an ohce | ||
luqui | semicolons are used! They're just optional on the last statement of a group | 15:06 | |
?eval say "foo"; say "bar"; say "baz" | |||
evalbot_8414 | OUTPUT[foo bar baz ] bool::true | ||
Mahmoud | it is optional in some cases with perl five too | ||
azuroth | ?eval say "concat " ~ "strings"; | ||
evalbot_8414 | OUTPUT[concat strings ] bool::true | ||
azuroth | ?eval say "concat " . "split"(""); | 15:07 | |
evalbot_8414 | Error: unexpected "." expecting operator, ":", ",", term postfix, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
azuroth | ?eval say "concat " . split(""); | ||
evalbot_8414 | Error: unexpected "." expecting operator, ":", ",", term postfix, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
Mahmoud | wtf? | ||
audreyt | ?eval "concat".split; | ||
evalbot_8414 | ("concat",) | ||
luqui | we changed string concat from . to ~ | ||
audreyt | ?eval "concat".split(''); | ||
luqui | so that we could have . for method call | ||
evalbot_8414 | ("c", "o", "n", "c", "a", "t") | ||
Mahmoud | heh why? | ||
azuroth | ?eval say "concat " .split(""); | ||
evalbot_8414 | OUTPUT[concat ] bool::true | 15:08 | |
azuroth | ?eval "concat " .split(""); | ||
Mahmoud | so . is for only method call? | ||
evalbot_8414 | ("c", "o", "n", "c", "a", "t", " ") | ||
azuroth | ?eval "concat " ."split"(""); | ||
evalbot_8414 | Error: unexpected "." expecting operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
luqui | Mahmoud, yes | ||
azuroth, what are you trying to do? | |||
Mahmoud | nice.. | ||
azuroth | I dunno. can you do sort of method pointers? | 15:09 | |
?eval $a = &String::split; "blah".$a(""); # kind of like this maybe? | |||
evalbot_8414 | Error: unexpected "." expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
luqui | yeah, but they're harder in perl 6 (you have to really shout at perl to say I'M USING A SYMBOLIC LOOKUP) | ||
but I don't think it's implemented in pugs yet | |||
azuroth | ahh | 15:10 | |
audreyt | mm? pugs does do symbolic lookup. | ||
luqui | ?eval my $a = "say"; "foo".::($a)() | ||
evalbot_8414 | Error: unexpected "." expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
luqui | then is my syntax wrong | ||
audreyt | ?eval my $x = 1; $::('x') | ||
evalbot_8414 | \1 | ||
luqui | audreyt, how do you do it for methods? | ||
azuroth | ?eval ("a", "b", "c").join(" ") | 15:11 | |
evalbot_8414 | "a b c" | ||
audreyt | luqui: I'm sorry but, I don't think that is in the spec. | ||
azuroth | ?eval ("a", "b", "c")>>.~(" test") | ||
evalbot_8414 | Error: unexpected ">" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
luqui | audreyt, oh. let me look. I'm pretty sure that's the way it's done. | ||
so the spec may need to be updated ;-) | |||
audreyt | yes, please do. | 15:12 | |
azuroth | ?eval ("a b c", "b c d", "c d e")>>.split(" ") | ||
evalbot_8414 | Error: unexpected ">" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
azuroth | ?eval ("a b c", "b c d", "c d e") >>.split(" ") | ||
evalbot_8414 | Error: unexpected ">" expecting operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input | ||
azuroth | hmm. is that not how you do hyper-method, or is it not implemented? | ||
audreyt | azuroth: yeah, unidirectional hyper is not yet parsed. | ||
we currenly only do bidirectional ones. | |||
luqui: have you seen my OpTable.hs? | |||
azuroth | aww. that's still cool :-D | 15:13 | |
audreyt | ?eval (1, 2, 3) >>+<< 4 | ||
evalbot_8414 | (5, 6, 7) | ||
luqui | audreyt, well, it was in A12, but there's nothing in the synopses | ||
audreyt | luqui: A12 is not normative so I pretend it does not exist :) | ||
luqui thinks that's a good plan | |||
audreyt | please do a carry over | ||
luqui | audreyt, I did look at OpTable.hs | ||
but not very much | 15:14 | ||
I'm pretty much done with the basic combinators | |||
audreyt | k. I think mostly you just need the data structures | ||
spent quite some time getting them concise enough | |||
the parse algorithm itself can be implemented in every which way. | |||
luqui | sure | ||
Larry says "OP parsing is not quite so simple as bubble sort, but not quite so subtle as quicksort" | 15:15 | ||
and I don't think quicksort is subtle | |||
so... should be fine | |||
audreyt | heh | ||
it's definitely more complicated than quicksort | |||
because we allow dynamic alternation of optable | 15:16 | ||
luqui doesn't see how that makes anything more complicated | |||
audreyt | (which PGE::OpTable doesn't yet do, so I'd have to invent my own callback system) | ||
luqui: some terms may be functions that alters the table itself | |||
so when you parsed the first half of circumfix | |||
it may introduce something that clashes with the closing half | 15:17 | ||
luqui | but that's okay, you'll get the clash when you get there | ||
azuroth | ?eval sub postfix:<!> (Num $a) { if $a == 1 return 1; return $a * ($a - 1)!;} say 10!; | ||
evalbot_8414 | Error: unexpected "i" expecting ";", statements or "}" conditional missing body or reserved word | ||
luqui | but I guess I won't really understand until I try to do it | ||
azuroth, I don't think postfix works | 15:18 | ||
audreyt | $x[ BEGIN{our &prefix:<]> := ...} ]; | 15:19 | |
?eval sub postfix:<!> ($x) {[*]1..$x}; 10! | |||
evalbot_8414 | 3628800 | ||
audreyt | it does work. | ||
it's the "if" syntax | |||
luqui | oh right | ||
azuroth | ohh yeah. :-p | ||
luqui | I just remember playing with postfix and being frustrated | 15:20 | |
azuroth | ?eval sub postfix:<!> (Num $a) { if $a == 1 { return 1; } return $a * ($a - 1)!;} say 10!; | ||
evalbot_8414 | Error: unexpected "}" expecting term postfix, operator, ">>xx<<", ">>+&<<", ">>+<<<", ">>+><<", ">>~&<<", ">>~<<<", ">>~><<", ">>*<<", ">>/<<", ">>%<<", ">>x<<", "\187xx\171", "\187+&\171", "\187+<\171", "\187+>\171", "\187~&\171", "\187~<\171", "\187~>\171", "\187*\171", "\187/\171", "\187%\171", "\187x\171", "xx", "+&", "+<", "+>", "~&", "~<", "~>", "*", "/", "%", "x", ":", ",", postfix conditional, postfix loop, postfix iteration, ";" or "}" | ||
luqui | heh, I find myself writing this in Perl a lot: | ||
if $foo { | |||
then bar | |||
oh crap | |||
it's perlskell | |||
azuroth | ?eval sub postfix:<!> (Num $a) { if ($a == 1) { return 1; } return $a * ($a - 1)!;} say 10!; | ||
evalbot_8414 | Error: unexpected "}" expecting term postfix, operator, ">>xx<<", ">>+&<<", ">>+<<<", ">>+><<", ">>~&<<", ">>~<<<", ">>~><<", ">>*<<", ">>/<<", ">>%<<", ">>x<<", "\187xx\171", "\187+&\171", "\187+<\171", "\187+>\171", "\187~&\171", "\187~<\171", "\187~>\171", "\187*\171", "\187/\171", "\187%\171", "\187x\171", "xx", "+&", "+<", "+>", "~&", "~<", "~>", "*", "/", "%", "x", ":", ",", postfix conditional, postfix loop, postfix iteration, ";" or "}" | ||
azuroth | ?eval sub postfix:<!> (Num $a) { if ($a == 1) { return 1; }; return $a * ($a - 1)!;} say 10!; | ||
evalbot_8414 | Error: unexpected "}" expecting term postfix, operator, ">>xx<<", ">>+&<<", ">>+<<<", ">>+><<", ">>~&<<", ">>~<<<", ">>~><<", ">>*<<", ">>/<<", ">>%<<", ">>x<<", "\187xx\171", "\187+&\171", "\187+<\171", "\187+>\171", "\187~&\171", "\187~<\171", "\187~>\171", "\187*\171", "\187/\171", "\187%\171", "\187x\171", "xx", "+&", "+<", "+>", "~&", "~<", "~>", "*", "/", "%", "x", ":", ",", postfix conditional, postfix loop, postfix iteration, ";" or "}" | ||
azuroth | eek. time to give up | ||
luqui | azuroth, it may be a problem with using ! inside your definition of ! | 15:21 | |
I think that's a currently half-working feature | |||
azuroth | ahh | ||
audreyt | ?eval sub postfix:<!> (Num $a) { if ($a == 1) { return 1; } return $a * ($a - 1)!; }; 10! | ||
evalbot_8414 | Error: unexpected " " expecting term postfix, operator, ">>xx<<", ">>+&<<", ">>+<<<", ">>+><<", ">>~&<<", ">>~<<<", ">>~><<", ">>*<<", ">>/<<", ">>%<<", ">>x<<", "\187xx\171", "\187+&\171", "\187+<\171", "\187+>\171", "\187~&\171", "\187~<\171", "\187~>\171", "\187*\171", "\187/\171", "\187%\171", "\187x\171", "xx", "+&", "+<", "+>", "~&", "~<", "~>", "*", "/", "%", "x", ":", ",", postfix conditional, postfix loop, postfix iteration, ";" or "}" | ||
audreyt | weird | ||
luqui | (azuroth, though in perl 6 it is legal) | ||
Mahmoud | looks like larry wall created a new hash algorithm | ||
luqui | Mahmoud, ? | ||
azuroth | ?eval [~]("a ", "b ", "c") | 15:22 | |
avar | ?eval <Ʀ ư> | ||
evalbot_8414 | "a b c" | ||
("\\", "\\") | |||
audreyt | ?eval sub postfix:<!> (Num $a) { if ($a == 1) { return 1; } return $a * &?SUB($a - 1); }; 10! | ||
evalbot_8414 | 3628800 | ||
Mahmoud | i was away, and when I returned back to the irc window, i shocked with all the symbols on the screen | ||
luqui | haha | ||
avar | $ pugs -e 'say <Ʀ ư>.perl' | ||
('ĆĀ¦', 'ĆĀ°') | |||
luqui | yeah, azuroth has been making perl barf all over the screen | ||
azuroth | ^_^; | ||
Mahmoud | heh | ||
avar | $ pugs -e 'say for <Ʀ ư>' | ||
Ʀ | |||
Ć° | |||
why does this happen | |||
Mahmoud | i was googling for 'mod_perl vs mod_php' .. i hope i'm not trolling | ||
luqui | avar, it's probably something with the IRC interface | 15:23 | |
avar | pugs normally prints out multibyte characters properly but the .perl method doesn't | ||
luqui | oh | ||
avar | luqui: that's on my local machine... | ||
luqui | yeah, I just figured that out ;-) | ||
Mahmoud | any benchmark you guys know about mod_php vr mod_perl? | ||
avar | ;)) | ||
luqui | avar, good question. | ||
luqui experiments | |||
avar | looks like I need to write another t/pugsbugs/file ;) | 15:24 | |
luqui | avar, works for me | ||
audreyt | please do :) | ||
luqui | something with your config maybe | ||
Mahmoud | i'm afraid that i wasted my time with Perl :D | ||
devorce time.. | |||
:P | |||
luqui | Mahmoud, huh? Why? Why? Don't leave!! | ||
:-) | |||
Mahmoud | no sorry.. i'll leave.. | ||
avar | luqui: what locale are you using? | 15:25 | |
luqui: I have en_US.utf8, maybe that's it.. | |||
luqui | en_US.utf8 | ||
avar | mm | ||
Mahmoud rides his horse and leaves | |||
luqui | avar, oh, by the way | ||
your example above, where you quoted $ pugs -e 'say for <...>' # I can't type those characters | 15:26 | ||
looked completely fine to me | |||
the output was precisely those two characters | |||
Mahmoud | luqui, don't worry.. i'll not leave.. i'm staying with you.. don't be afraid | ||
avar | luqui: it looks fine here too, what doesn't look fine is say <Ʀ ư>.perl | ||
luqui | oh | ||
luqui looks | |||
avar | $ perl -Mutf8 -e 'print ord for split //, "say <Ʀ ư>.perl"; print "\n"' | 15:27 | |
115971213260230322406246112101114108 | |||
just to make sure we're giving it the same input;) | |||
luqui | ("\d[230]", "\d[240]") | ||
yep, it's the same | 15:28 | ||
that line is what I get | |||
avar | $ pugs -e 'say "Ʀ".perl; say "Ʀ"' | ||
'ĆĀ¦' | |||
Ʀ | |||
simplified testcase | |||
do those two come out the same for you? | 15:29 | ||
luqui | avar, try putting some input in a file | ||
"\d[230]" | |||
Ʀ | |||
that's what I get | |||
avar | $ pugs say.p6 | ||
'ĆĀ¦' | |||
Ʀ | |||
$ cat say.p6 | |||
say "Ʀ".perl; | |||
say "Ʀ"; | |||
same stuff | |||
$ file say.p6 | |||
say.p6: UTF-8 Unicode text | |||
luqui | avar, what terminal are you using? | ||
well, your term is probably fine | 15:30 | ||
given that you can cat correctly | |||
avar | I'm sure my terminal is fine with regards to spitting out UTF-8, I work on UTF-8 all day;) | ||
xterm with -en utf8 and LC_ALL=en_US.utf8 | |||
(the LC_ALL is important) | |||
-en UTF-8 actually.. | |||
luqui | avar, that's very strange then | 15:31 | |
avar, and this is the latest svn? | |||
avar | nah, 6.2.10 | ||
luqui | oh, that could be it | ||
avar | I should compile the latest maybe;) | ||
luqui | I put in a patch a month ago or some that dealt with this sort of thing | ||
s/some/so/ | 15:32 | ||
avar | I'll make a testcase for it regardless, just to make sure there aren't any regressions | 15:33 | |
luqui | thanks | ||
oh, avar | 15:34 | ||
you probably can't commit | |||
openfoundry is being a bastard | |||
what kind of business isn't open on christmas eve! Geez! | |||
avar | christmas day;) | 15:35 | |
luqui | christmas day? You're saying you're 16 hours away from me? | ||
avar | I'm saying that CD isn't the 25th everywhere in the world;) | ||
luqui doesn't know much about timezones, but he didn't think that that was possible | |||
oh | |||
oh, I get it | |||
avar | It's the 24th here | 15:36 | |
luqui | that's cool | ||
where are you? | |||
avar | Iceland | ||
luqui | interesting | ||
avar | It's like that in .dk too | ||
and probably .no,, .sv | |||
although I'm not sure | |||
mm | 15:38 | ||
the perl6.vim file needs fixing | |||
It doesn't autodetect perl6 for some reason | |||
plus it defaults to that awful coding style *ducks* | |||
luqui | perl6.vim isn't the thing that autodetects | 15:39 | |
you need a filetype detector, and I'm pretty sure there isn't one in the pugs repo | 15:40 | ||
avar | mm | ||
the std vim syntax files do that somehow | |||
I think | |||
luqui | yeah | ||
.vim/filetype.vim is where you put custom ones | |||
vim has a global filetype.vim that it uses | |||
Mahmoud | going to cut my beard heh :P | ||
1+ cm long | 15:41 | ||
15:41
Mahmoud is now known as Mahmoud-Afk
|
|||
pasteling | "luqui" at 67.165.197.242 pasted "My .vim/filetype.vim" (19 lines, 655B) at sial.org/pbot/15110 | 15:42 | |
avar | heh, .wiki ;) | 15:43 | |
does that actually work for anything non-simple? | |||
luqui | does what actually work? | ||
avar | mediawiki syntax highlighting | 15:44 | |
that file works a charm, thx;) | |||
luqui | it seems to be pretty good | ||
avar | mm | ||
avar MW dev | |||
our syntax sucks;/ | |||
luqui | it doesn't make any sense if you dont have those filetypes in your ftplugin | ||
of course | |||
by which i mean in your syntax/ | 15:45 | ||
avar | hah | ||
It's kind of like php | |||
it wasnt designed, it kind of just grew like cancer | |||
luqui | you guys should abruptly change to kwid | ||
15:45
Mahmoud-Afk is now known as Mahmoud
|
|||
avar | what's that? | 15:45 | |
luqui | kwid is a wiki syntax designed by ingy | 15:46 | |
luqui likes it a lot | |||
Mahmoud | heh.. php is cancer LOL | ||
avar | well, actually the main problem with it is not the syntax itself, but the parser we're using | ||
luqui | avar, really? | ||
avar | it doesn't use a parse tree because php would be too slow for that, it's just a regexp hack | ||
luqui | yuck | ||
like Pod::Parser | |||
yeah, I always thought that MW was a fairly nice piece of software | 15:47 | ||
I wanted to submit a patch, and found that it was only nice on the outside | |||
with a heart black as coal | |||
avar | It's very different, | 15:48 | |
that parts I write are nice & clean;) | |||
15:48
Mahmoud is now known as Mahmoud-Afk
|
|||
luqui | of course. all those other parts are hard to understand ;-) | 15:48 | |
avar | since I'm pretty fanatical about cleanness...;) | ||
I guess it suffers from pretty much the same problem as most php apps | 15:49 | ||
1. written as a hack | |||
2. still a hack | |||
luqui is being a good boy at the moment and documenting his code | |||
avar | 3. hard to extend hack | ||
luqui | php makes it hard to exercise good software engineering practices | ||
whereas perl makes it easy to do so... (but perl also makes it easy to write complete crap) | 15:50 | ||
avar | php5 is slightly better | ||
luqui | (which java claims it makes hard to do) | ||
avar | you can't make private members for classes in php4 for example, which is .. insane | ||
luqui | (but I claim that it's impossible for any language to do that) | ||
(except Haskell. it's very hard to write crap in haskell, because it's hard to write anything in haskell) | 15:51 | ||
avar | hahah | ||
luqui | (if you don't really think through the problem, Haskell's vagueness-killer will get you) | ||
(end of long parenthetical) | |||
(really) | |||
avar | Working on MW is kind of fun because you get to please the crowd, few FS projects are like that, I guess;) | 15:52 | |
luqui | what is that acronym FS? | ||
avar | free software | ||
luqui | oh, of course | ||
well, you get to do that to a certain crowd in Perl | 15:53 | ||
except that is a crowd that seems not capable of being pleased | |||
avar | ;) | ||
luqui | avar, spent any time on p6l? | ||
avar | perl6-language? | 15:54 | |
luqui | yeah | ||
avar | I subscribe to it since ~1wk ago, haven't posted anything | ||
luqui | ahh | ||
so you missed the "self", um, "debate" | |||
that's good | 15:55 | ||
avar | self.* ? | ||
luqui | coming up with *optional* syntax to call methods on self | ||
even the people who said they would never ever use it fought against it | |||
and then when we said "okay, there's no syntax" | 15:56 | ||
everybody said "no, there needs to be a syntax" | |||
which is much more like "it needs to be *my* syntax" | |||
avar | you mean something like $this-> and this. in php, ruby & C# ? | ||
luqui | yeah | ||
the one I liked best was ./method | |||
oh, and in C# at least, can you just say method() as shorthand for self.method() ? | 15:57 | ||
luqui hasn't done much C# | 15:58 | ||
Khisanth | not really like $this-> and this. ... since that would just be $self. | ||
or whatever depending on you prototype and pragmas? :) | |||
luqui | use Perl6::Attributes; ./method(...) :-) | 15:59 | |
avar | I like self.method | ||
Khisanth | that is irrelevant for that particular thread :P | ||
luqui | yeah | 16:00 | |
so Larry made a decision that pleased nobody at all | |||
and then later he quietly changed it to something else | |||
without telling anyone about it | |||
"if you have an objection to it, you'll have to read the spec to find out what you're objecting to first!" | |||
Khisanth | our $Larry is sneaky; | 16:01 | |
luqui | and all the whiners are too lazy to read the spec | ||
Khisanth | perl6 is just a plot to make writing poetry easier! | ||
luqui doesn't get it | 16:02 | ||
luqui knows about perl poetry | |||
luqui still doesn't get it | |||
Khisanth | I mean it adds a lot more usable vocabulary | ||
luqui | oh, you were referring to "our $Larry is sneaky;". Now I get it. | 16:04 | |
is, but, does, when, ... | |||
Khisanth | lazy :) | 16:06 | |
audreyt | whew. 4 journal entries today. | 16:17 | |
I think I deserve sleep :) | |||
luqui should read those | 16:18 | ||
luqui thinks it's funny that you can write pages of code and still need more | |||
but write 4 journal entries and be wasted | |||
luqui works the same way, though | 16:19 | ||
audreyt | I think English is a really sloppy programming language. | ||
but maybe that's a virtue :) | 16:20 | ||
gaal | either that, or humans are a hell of a complex platform. | ||
luqui | Well, you think that, until you meet an expert English programmer. | ||
audreyt | it's probably both :) | ||
avar | audreyt: mm, url yo journal?;) | ||
*to | |||
audreyt | avar: see topic | ||
(pugs.blogs.com) | |||
ingy: see you in RL tomorrow :) | 16:21 | ||
audreyt waves & | |||
gaal | bye audreyt :) | ||
avar | I wonder if there are any rss viewser (preferrably for firefox) that don't suckl | 16:26 | |
I'm using gmail's ATM | 16:27 | ||
luqui | openfoundry is back | 16:31 | |
clkao | zzz | 16:32 | |
svnbot6 | r8415 | luqui++ | Fixed interpretation of curlies to make a hash. The following: | ||
r8415 | luqui++ | { %foo } | |||
r8415 | luqui++ | { %$foo } | |||
r8415 | luqui++ | { %foo, a => 1, b => 2 } | |||
r8415 | luqui++ | are now interpreted correctly. | |||
r8416 | luqui++ | Backtracking controls. | |||
r8417 | luqui++ | Change "cut"'s name to "commit", even though what I'm doing is a little more general than commit. | |||
r8418 | luqui++ | A little documentation. | |||
rafl_ | Who wrote the smoke/yaml_harness stuff? | 16:33 | |
luqui dunnos | |||
clkao | iblech? | 16:34 | |
rafl_ | He only wrote the smokeserv, afaik. | 16:38 | |
audreyt | yaml harness is nothingmuch and gaal's doing I believe | 16:40 | |
svnbot6 | r8419 | luqui++ | A little bit more documentation, for the slightly tricky quantify combinator. | 16:44 | |
gaal | rafl_: yup, I wrote the initial version based on Straps and nothingmuch did most of the refactoring into the TAP modules. | 16:46 | |
svnbot6 | r8420 | luqui++ | Minimal quantifiers. | 16:53 | |
r8421 | luqui++ | Making sure that quantifiers are maximal by default. | |||
Khisanth | rafl_: couldn't you ask the svn server? :) | 17:08 | |
slavik | so, when is perl6 supposed to be released? | 17:10 | |
Khisanth | EOT | 17:14 | |
integral | Christmas! :-P | 17:22 | |
Khisanth | tomorrow?! | 17:29 | |
slavik | sweet :P | 18:12 | |
avar | my 1st post to perl6-language;) | 18:54 | |
luqui | except you're wrong :-) | 18:58 | |
no, not really. but you could have been a little more right | 18:59 | ||
@Larry (or, more specifically, @Larry - lwall - luqui) think that there should be an "official" implementation | 19:00 | ||
which is written in PIR (ugh) and runs on Parrot | |||
and all other implementations try as hard as they can to conform to that one | 19:01 | ||
but I'm ashamed of that position, so I didn't want to reply... | |||
avar | @Larry? | 19:02 | |
luqui | design team | ||
avar | ah | ||
luqui | clever pun... | ||
avar | explain;) | ||
luqui | the array of Larrys | ||
anyway... | |||
oh, cool name, by the way | 19:03 | ||
er, cool looking. I have no idea what it sounds like. | |||
avar | ;) | ||
I have an ogg vorbis of the pronounciation somewhere... | |||
so what *is* the status with regards to specs? | 19:06 | ||
svnbot6 | r8422 | luqui++ | Optional, and some untested anchors. | ||
luqui | well, the reason there are specs is because larry didn't want to program | ||
avar | hah | ||
luqui | (he did this for the sake of the code... or so he says) | ||
Larry creates little languages wherever he goes, so it's often hard for people to grok his code without immersing themselves in it | 19:07 | ||
there are a couple more reasons that it's good that larry doesn't program | |||
for instance, when you're writing the language, it's easy to specify the behavior that's easiest to implement | 19:08 | ||
rather than easiest to use | |||
avar | Of course there are downsides to that as well, you're likelier to specify things that might conflict if you're not implemnting it too | 19:09 | |
luqui | that's actually not true... | 19:10 | |
we get plenty of conflicts in pugs | |||
and nobody realizes them for a long time | |||
until somebody says "hey, this doesn't seem like what it's supposed to do" | |||
There is one downside that I see | 19:11 | ||
and it's the same as the upside | |||
I have a strong belief that what's easiest to implement is often the right thing to do | |||
(as long as there is a solid design) | |||
so you don't get some of those wacky over-dwimmy situations that we've seen throughout the design process | 19:12 | ||
(all of which eventually get boiled down into something consistent and predictable, thankfully) | |||
avar | an assembly language would be easiest to implement;) | 19:40 | |
19:41
DesreveR is now known as r0nny
|
|||
SamB | the trouble with DWIM is that it is overly hand-wavey; sometimes you still haven't figured out what you mean yourself, how can you expect the computer to do it? | 19:58 | |
buu | SamB: If you haven't figured out what you want, why are you typing code? | 20:04 | |
Mahmoud-Afk | hi buu :) | 20:23 | |
20:23
Mahmoud-Afk is now known as Mahmoud
|
|||
Mahmoud | IRC Rule #586: Bosses never replay 'Hi's. :/ | 20:24 | |
reply* | 20:25 | ||
buu | ZOMG. | ||
Mahmoud | looks like calture difference.. here it's very rude to not reply 'hi','salam' or any welcome message. | 20:26 | |
here means UAE | |||
tewk | ls | 20:27 | |
obra | Mahmoud: around here, it's not particularly rude. With the number of folks coming and going, that would be..a lot of traffic | 20:28 | |
But welcome :) | |||
Mahmoud | I see.. | ||
reasonable :) | |||
practical people ;) | |||
obra | That is the perl thing, yes ;) | 20:29 | |
azuroth | good morning | 20:37 | |
dduncan | mawnin | 20:57 | |
foundry's up, so will push momentarily | 20:58 | ||
azuroth | hey hey | ||
dduncan | and the same person who was here just before I left, and had the f trouble | ||
done; now the p6 and p5 repos are in sync | 21:00 | ||
svnbot6 | r8423 | Darren_Duncan++ | r1562@Darren-Duncans-Computer: darrenduncan | 2005-12-24 01:04:36 -0800 | ||
r8423 | Darren_Duncan++ | /ext/Rosetta-Incubator : major update to lib/SQL/Routine.pm; for the Document and Node classes both, added full attr decls in code and docs, added full BUILD submethod, and export_as_hash() method, to code and docs | |||
dduncan | ?eval my %h = { 4 => 5 }; my $bar = { %foo }; $bar; | 21:42 | |
21:43
evalbot_8414 is now known as evalbot_8423
|
|||
evalbot_8423 | Error: Undeclared variable: "%foo" | 21:43 | |
dduncan | ?eval my %foo = { 4 => 5 }; my $bar = { %foo }; $bar; | ||
evalbot_8423 | {("4" => 5),} | ||
Juerd | dduncan: Don't assign a *reference* to a hash. | 22:02 | |
luqui | that actually seems to be a bug | ||
his code shouldn't work, but it did. | |||
dduncan | oh | ||
Juerd | { } returns a reference. Hash assignment works with lists. | 22:03 | |
dduncan | I have had issues with related matters for awhile | ||
luqui | ?eval my %a = { a => 1, b => 2 }; say %a<b> | ||
evalbot_8423 | OUTPUT[2 ] bool::true | ||
luqui | yep, wrong | ||
Juerd | ?eval my @foo = [ 1 ]; | ||
evalbot_8423 | [[1,],] | ||
luqui | I fixed it for lists, though | ||
Juerd | That works better. | ||
luqui: Arrays :) | |||
dduncan | so is %hash = $hashref wrong then? | ||
luqui | it didn't before yesterday | ||
Juerd, :-) stupid words. why couldn't they be more like numbers? | 22:04 | ||
dduncan | there was a checkin about this yesterday | ||
Juerd | dduncan: Not if %hash is declared to have non-string keys. | ||
%hash = $hashref just means %hash = ($hashref => undef) | |||
luqui | with a warning | ||
dduncan | so what is the proper way to copy a hash | ||
Juerd | Yeah, odd number blah blah :) | ||
dduncan: my %hash2 = %hash1.copy; | 22:05 | ||
luqui | dduncan, you copied the hash correctly | ||
Juerd | Alterantively, just: | ||
my %hash2 = %hash1; | |||
dduncan | so that works then | ||
Juerd | Sure. | ||
dduncan | and %!hash2 = %hash1 works | ||
Juerd | %hash1 is in list contex | ||
dduncan | and $foo!hash2 = %hash1 works? | ||
Juerd | What's %foo? | ||
eh | |||
What's %!foo? | 22:06 | ||
luqui | private member | ||
Juerd | Oh my, when did that happen? | ||
luqui | dduncan, the latter is doing something quite different | ||
because %hash1 in that case is in *scalar* context | |||
Juerd | Does %foo in list context eval to .kv or to .pairs? | ||
luqui | .pairs | ||
Juerd | Great :) | ||
dduncan | my last 2 lines were both referring to object attributes that were hashes | ||
Juerd | No more while-each. I hate while-each. | 22:07 | |
dduncan | but one specified the object name | ||
luqui | dduncan, it's all about the sigil | ||
if you write it with a %, then it's a hash | |||
otherwise it's a hash reference | |||
Juerd | I tend to write short subs, and to return as early as possible. while-each sucks so much that I'm accustomed to for (keys %foo) { $foo{$_} ) | ||
dduncan | so if $obj is an object ... | ||
luqui | Juerd, me too | ||
Juerd | Which is ugly, but at least works. | ||
dduncan | what is the syntax to set its %!hash attr? | 22:08 | |
Juerd | I don't get why people love iterators. They SUCK :) | ||
Lists rock, iterators suck. | |||
luqui | $obj!hash = {...} # note the curlies | ||
Juerd | And we don't need iterators now that we have lazy lists. Hurrah! | ||
luqui | that is, you assign it a reference | ||
dduncan | okay | ||
luqui doesn't mind iterators | 22:09 | ||
dduncan | so with %!foo I assign as a %hash, and with $obj!foo I assign as a $hashref? | ||
luqui hates implicit iterators | |||
yep | |||
dduncan | okay ... | ||
Juerd | luqui: Okay, that works for me :) | ||
dduncan | I have committed code that isn't sure how to do it ... will fix | ||
one more thing ... | |||
Juerd | I've abused scalar glob yesterday, though ;) | ||
dduncan | the syntax to generate one hash ref that is a copy of another hash ref? | ||
is it {*%{$hashref}} ? | 22:10 | ||
luqui | Juerd, isn't the fact that you're using it in the first place a good indicator that you're abusing it :-) | ||
dduncan, unfortunately, that doesn't work | |||
Juerd | luqui: If there's no ? or * in there, yea :) | ||
luqui | { %$hashref } will work fine | ||
dduncan | and { %{$hashref} } too I assume? | 22:11 | |
luqui | also in perl 6 (but not necessarily in pugs), $hashref.copy | ||
Juerd | glob "{a,b,c,...,z}{0,1,2,...,9}{0...9}{0...9}", but in full, can be SO useful :) | ||
luqui | ah, that glob | ||
dduncan called away ... back in 15m or so | |||
Juerd | my @ids = lazy_ids(); shift @ids; | 22:12 | |
Lalala :) | |||
luqui | yes, but there really needs to be a more general mechanism | ||
list comprehension | |||
Juerd | Agreed | ||
Though syntax is hard. | |||
dduncan | I was using the '*' there to mean splatty, or something | ||
luqui | yeah, that's the biggest problem | 22:13 | |
everything's already taken | |||
Juerd | For more advanced stuff like list comprehension, I'd think WORDS as opposed to SYMBOLS, would help a lot. | ||
luqui | dduncan, yeah, but if there's anything besides a hash or a pair in curlies, it's taken to be a coderef, not a hash | ||
dduncan | say if you want to populate a sub's arg list from a %hash | ||
luqui | that's the problem with the * | ||
Juerd, you might be onto something there | |||
Juerd | Because symbols are taken, but also because much of the Perl target audience (sysadmins, one time scripters) doesn't regularly use these techniques. | ||
luqui | "where", the best word, is already taken though | ||
dduncan | back in a few mins | ||
Juerd | luqui: "where" isn't clear anyway | 22:14 | |
luqui | true | ||
any suggestions? | |||
Juerd | It may read naturally, but it communicates very little semantic information | ||
luqui: This is a good moment to admit I don't really know what list comprehension consists of :) | |||
luqui | it's just a notation that mixes multiple maps and greps together | 22:15 | |
for example: | |||
(in haskell, but I'll keep it simple) | |||
[ x + y | x <- [1..10], y <- [1..10], x > y ] | |||
[3,4,5,5,6,7,6,7,8,... | 22:16 | ||
(had to go to ghci to figure out what that would actually output) | |||
Juerd | Oh, right, audrey showed me in the very first days of pugs. Now I remember. | 22:17 | |
luqui | map { f($_) } @list <==> [ f(x) | x <- @list ] # Haskerl | 22:18 | |
Juerd | Well, remember... Not really, but I do recognise the example. | ||
Eh, s/example/syntax/ | |||
haskerl; heh | |||
luqui | grep { f($_) } @list <==> [ x | x <- @list, f(x) ] | ||
and it's all just generalizations from there | |||
[ expression | x <- sourcelist1, y <- sourcelist2, ..., condition1, condition2, ... ] | 22:19 | ||
Juerd | Right | ||
And why not using foreach? | |||
luqui | you mean: for @sourcelist1 -> $x { for @sourcelist2 -> $y { push @result, expression($x,$y) if condition1 && condition2 } } | 22:20 | |
that's why | |||
Juerd | my @res = for @foo -> $foo, @bar -> $bar { next unless condition; ...; f($foo + $bar); } | ||
What exactly is why? Notation? | 22:21 | ||
luqui | we could let for return the list of its results instead of the last thing evaluated | ||
and then that might work | |||
Juerd | Otherwise, simply: | ||
luqui | the main reason for mine was that it's imperative | ||
but for can't do that yet | |||
Juerd | my @res = gather { for { for { take ... if ... } } }; | ||
Larry doesn't want if and for to return things. I want them to. :( | 22:22 | ||
??:: should simply desugar to if/else | |||
luqui | Juerd, you can | ||
Juerd | But so far, it's just in my head. | ||
luqui | ?eval my $x = do if 1 { 4 } else { 5 }; $x | ||
evalbot_8423 | \4 | ||
Juerd | I see. | ||
I don't think I understand "do" there. | |||
luqui | you can "do" that with any statement-level construct | ||
it just turns statementy things into expressiony things | 22:23 | ||
Juerd | Why is the word needed? | ||
We have context! | |||
dduncan | question, if the sigl's the thing ... | ||
luqui | because there's a syntactic difference | ||
Juerd | void context: statement, other context: expression. | ||
What difference? | |||
dduncan | say we have @list_of_obj ... | ||
luqui | first, semicolons | ||
Juerd | Semicolons were fixed with the whitespace hack | ||
luqui | only sortof | ||
dduncan | how do we set a hash attribute of one array element that is an object? | ||
luqui | anyway, Larry thinks it's important to have a difference between statements and expressions | ||
Juerd | I know he does :( | 22:24 | |
dduncan | eg, @list_of_obj[0].hash = ? | ||
or also | |||
Juerd | dduncan: Have you ever used Perl 5? | ||
dduncan | yes | ||
but there we have $ all the time | |||
Juerd | Because in the current state of Perl 6, it may not be wise to use it to learn Perl. | ||
luqui | Juerd, braces. if if $foo { } else { } { } else { } | 22:25 | |
dduncan | Juerd, ... | ||
luqui | or rather | ||
if if $foo { } else { } | |||
dduncan | I am very experienced with perl 5, but for some strange-seeming aspects | ||
Juerd | dduncan: % is for hashes, @ is for arrays, $ is for scalars (including references) | ||
dduncan | and I'm also trying to write correct code in perl 6 | ||
Juerd | dduncan: This does not change. | ||
dduncan: Even if the hash is used for a slice or a single element, it's still %. | |||
luqui | dduncan, okay, it's not all about the sigil there... | ||
Juerd | However, if you have a reference, even if it points to the same hash, it's $. | 22:26 | |
dduncan | so I'm learning perl 6 | ||
luqui | it's more like, it's all about the variable | ||
or something | |||
um... @foo and %foo expand themselves in list context | |||
that's the only thing that distinguishes them from scalars | |||
Juerd | luqui: But the braces thing is the same thing that happens with any bracketed construct: if it becomes complex, more parens are needed. We have precedence for paren-thingies, but more importantly: warnings. Nesting curly-thingies could simply be made impossible without parens. | 22:27 | |
dduncan back in a bit | |||
luqui | "it's all about the sigil" was an overgeneralization | ||
Juerd | if (if $foo { } else { }) { ... } else { ... } | ||
luqui | no, the second one | ||
Juerd | With "if if" being a parse error | ||
luqui | why is if if a parse error? | ||
Juerd, do you know about parsers? | |||
Juerd | Because it uses to statement: things without encountering parens :) | 22:28 | |
luqui | so when can you use a statementy thing? | ||
Juerd | statement:* would then be allowed only on statement level, and within parens. | ||
luqui | so only after parens? | ||
then you can't say: my $x = if 1 { } | |||
you'd have to say: my $x = (if 1 { }) | |||
which is kinda what we did with do, except do looks nicer | 22:29 | ||
Juerd | I don't know much about parsers. I do believe that parsing should be the last, not first, thing to consider when inventing syntax. | ||
luqui | yes, but thinking about how the parser does it is kinda like Haskell in that it defoggies your thinking | ||
Juerd | I see your point re my parens suggestion. | ||
But I don't get why do-if would be possible while if would not. | 22:30 | ||
luqui | Chomsky believed that human languages were context-free. So if a parser can't do it, then humans can't easily do it. But Chomsky was full ot it anyway. ;-) | ||
Juerd | The first thing I'd be tempted to do is write an error handler automatically inserting "do" whenever parsing an "if" failse... | ||
s/failse/fails/ | 22:31 | ||
luqui | well... | ||
then you wouldn't get missing semicolon errors | |||
and we experienced programmers never get those anyway | |||
but noobs get them all the time | |||
Juerd | If you say so :) | ||
luqui | do you understand why you wouldn't get missing semicolon errors? | ||
Juerd | Javascript fixes the missing-semicolon thing the same way I'd fix the do-if thing: insert them automatically whenever parsing differently didn't work :) | 22:32 | |
luqui | sub foo { } my $x = foo \n if condition {...} else {...} | ||
Juerd | (Well, almost) | ||
luqui | except my example is a genuine error, and it parses fine | ||
foo will be getting a weird argument, though | 22:33 | ||
Juerd | But without the else { }, that's already not a trappable error. | ||
luqui | Juerd, how so? | ||
Juerd | my $x = foo if condition({ ... }) | ||
luqui | but that's been specified | 22:34 | |
when you see a block in operator position, it's the statement-level block | |||
22:34
Mahmoud is now known as Mahmoud-Afk
|
|||
Juerd | But back to list comprehension. I've read some more, and now understand it's not magic, but actually quite simple :) | 22:34 | |
luqui | yep | ||
Juerd | One thing I don't understand yet. Are the input lists walked in parallel? | 22:35 | |
Or do you get @x*@y iterations in total? | |||
luqui | no. they're done glob-style | ||
yes @x*@y | |||
Juerd | ok | ||
luqui | in Haskell, they're last-first | ||
(which makes the most sense to me, but could be argued either way) | 22:36 | ||
Juerd | comprehend @foo; @bar -> $foo, $bar { next unless $cond1 and $cond2 and $cond3; f($foo + $bar); } | ||
Which can be written in a minute or two? | 22:37 | ||
Or am I not understanding it correctly yet? | |||
luqui | Juerd, that's what I was thinking | ||
Juerd | That I'm not understanding it yet? | ||
luqui | no, the comprehend syntax | ||
the thing I like about list comprehension syntax from haskell and python is that it reads just like "set-comprehension" in maths | 22:38 | ||
in fact, it *is* that syntax :-) | |||
Juerd | I think the easy solution is to make for (be able to) return lists, even if it's only with do. | ||
You can always introduce macros for the nice syntax later. | 22:39 | ||
luqui | basically making for a statement-level map with reversed arguments | ||
luqui could live with that | |||
Juerd | What would we still need map for? | ||
Isn't map just list-returning for? :) | 22:40 | ||
luqui | reversed arguments. reads better sometimes. also, statement-level. | ||
Juerd | And can't one already do for { ... } <== @foo, if they really want arguments to be reversed? | ||
luqui | but statement-level isn't going to sell *you* :-) | ||
Juerd | No, statement level does nothing to me. Everything's an expression, and I'm happy. :) | ||
sub foo { ... } should just return \&foo. | 22:41 | ||
luqui | Juerd, you should take up haskell | ||
let x = if 1 then 4 else 5 | |||
Juerd | I know. | ||
If only I had a big bag of tuits | |||
luqui | yeah. It took me until we were driving out to Portland to get tuits | ||
avar | x = 1 ? 4 : 5; | ||
;) | |||
luqui | yeah, but Juerd is objecting to the fact that there are things that aren't expressions | 22:42 | |
oh, avar, and you mean $x = 1 ?? 4 !! 5; | |||
Juerd | I've began programming again, partly ignoring pain (CTS-like, but not CTS), because I'm a little more than out of cash. | ||
avar | luqui: that was C | ||
luqui | uh huh | ||
Juerd | avar: I thought it was Perl. | ||
luqui | but this is #perl6 | ||
luqui notices that that's perfectly good perl | |||
Juerd | { my $x; sub x : lvalue { $x } } x = 1 ? 4 : 5; | 22:43 | |
Heck, who needs sigils anyway. | |||
avar | are subroutines expressions or declerations in p6? | ||
luqui | I believe there was a module that gets rid of sigils precisely by doing that | ||
avar, if they have a name, then they are declarations | |||
if not, then they are expressions | 22:44 | ||
avar | mm | ||
Juerd | luqui: Getting rid of sigils (optionally!!) is one of the ideas in Perlego. | ||
avar | too bad, | ||
luqui | avar, por que? | ||
Juerd | Perlego is my reference Perl 6 | ||
avar | I kind of like def x(y) puts y; end if 2 in ruby;) | ||
luqui | avar, you mean you like how it looks, or you like the ability to do that? | ||
Juerd | my foo = 3; # from now on, we know what "foo" is, but we can use $foo too, if we want. | 22:45 | |
avar | how it looks, I know I can do it just by wrapping stuff in another block or something.. | ||
luqui | (to me, that looks like the "end" is under control of the "if", but nothing else) | ||
Juerd | It solves 50% of the line noise issue :) | ||
luqui | Juerd, should be pretty easy with a grammar munge | ||
Juerd | luqui: I thought so :) | ||
luqui | Juerd, might even be pretty easy with a source filter | ||
you should write it in perl 5 | 22:46 | ||
Juerd | But I keep striving to get things like that into standard Perl. | ||
luqui | yeah, but remember who I am... | ||
I'm that guy who hates when people talk about standard perl... | |||
Juerd | I think that configurability is GREAT, but that the default should be sane. | ||
And that syntax is one of the few things that needs specal sanity. | 22:47 | ||
special | |||
luqui too. he personally doesn't think that my foo = 3; is all that sane | |||
avar | mm, no sigil? | ||
Juerd | Well, that's okay. You're far from alone in thinking that, which just means that my idea wasn't a good one in the first place. | 22:48 | |
Which in turn means that I can save a lot of time writing a module that does it too. | |||
luqui | :-) | ||
Juerd | There are only two things left in my wishlists that I find really important. For the other things, I've been convinced that my ideas aren't sound, or they are already standard Perl 6. | 22:49 | |
avar | what does my x = 5; do ?;) | ||
Juerd | The two things left are <-> and parenless method calls. | ||
luqui | avar, nothing. | ||
Juerd, wants it to do the obvious thing. | |||
s/,// | |||
Juerd | avar: Nothing, but in the hypothetical Perlego, it'd declare $x and a sigilless alias for it, called x. | ||
luqui | Juerd, you do know that we have listop method call | 22:50 | |
avar | eh, what's the point? | ||
luqui | ?eval "foo bar".substr: 1, 3 | ||
evalbot_8423 | \"oo " | ||
Juerd | luqui: That's nice, but substr as a listop?! | ||
luqui thinks he agrees with Juerd about <-> | |||
avar | what would <-> do? | 22:51 | |
luqui | The : turns any method call into a listop | ||
Juerd | I see. | ||
I can very well live with that I think :) | |||
Although. | |||
luqui | avar, <-> is like ->, but it declares its arguments rw | ||
Juerd | Does it imply list context too? That would be unfun :( | ||
luqui | Juerd, well, I think "turns into a listop" they meant "parses like a listop" | 22:52 | |
Context is callee-side now anyway | |||
so it definitely doens't imply list context | |||
Juerd | Oh, that's interesting. How does that work? | ||
luqui | Juerd, it kinda doesn't | ||
that's one of the big gaping holes in the design | |||
Juerd | An @foo is flattened on the callee side? | ||
(when in slurp context) | 22:53 | ||
luqui | if foo is a multi: foo(bar()); | ||
we can't know what context to call bar() in until we know which foo() to call | |||
avar | luqui: isn't there an existing syn for that? | ||
luqui | but we can't know that until we call bar() | ||
Juerd | Hehe | ||
luqui | because it's a multi | ||
Juerd | Hmmm | ||
luqui | avar, existing syn for <-> ? | ||
yes: -> $x is rw, $y is rw { } | 22:54 | ||
Juerd | I've always assumed the context would be a disjunction | ||
avar | like for %hash.kv -> $k is rw, $v is rw { or somthing... | ||
luqui | yeah, that's legal | ||
it's just not as nice as <-> | |||
which is very mnemonic | |||
avar | I like is rw better...;) | ||
Juerd | multi foo (Foo $x) { ... }; multi foo (Bar $x) { ... }; foo(bar()); # bar is in Foo|Bar context | ||
And the foo is chosen according to what bar() actually returned. | |||
luqui | Juerd, that's one way to do it | 22:55 | |
avar | or were you planning to munge "<->" into subroutine argument lists ? | ||
or would they be a special case? | |||
luqui | Juerd, but if you're in Scalar|List context, what do you return? | ||
avar, -> declares a sub as it is | |||
?eval (-> $x { $x + 1 }).(10) | |||
evalbot_8423 | 11 | ||
Juerd | luqui: That's a context that doesn't exist in my head, for two reasons: 1. there are no List objects; 2. Main context type (item versus list) shouldn't be mixable across multis. | 22:56 | |
luqui | Juerd, the first one is just semantics. The second one probably ends up being right | ||
Juerd | List objects just don't work. | ||
avar | luqui: ew;) | ||
luqui | you don't use it unless it looks nice | ||
that's how a lot of perl programming goes | 22:57 | ||
you can abuse the syntax, but you can also use it to make things very readable | |||
Juerd | And I still think we should rename "list context" | ||
luqui | Juerd, it is renamed | ||
avar | I meant, if you want to replace for %hash.kv -> $k is rw, $v is rw { with for %hash.kv <-> $k, $v { what do you want to replace sub x(Num $x is rw) with? | ||
luqui | it's "Slurpy" context | ||
avar | nothing? | ||
luqui | yes, nothing | ||
Juerd | luqui: That's Pugs, not Perl 6. | ||
avar | or sub x(Num <-> $x or something | ||
luqui | Juerd, I believe it's perl 6, too | ||
Juerd | luqui: A conscious stray from Larry's path. | 22:58 | |
luqui | avar, certainly not! | ||
Juerd | No, Larry recently confirmed it's item versus list. | ||
luqui | Juerd, really? | ||
Juerd | Yes. | ||
luqui | messageid? | ||
Juerd | Hold on | ||
avar | luqui: I don't like it, two totally different ways to declare something as rw? | ||
Juerd | Mailbox is growing too large | ||
... | |||
luqui | avar, it's just sugar | ||
dduncan | okay, I'm back ... will fix and checkin stuff now ... | 22:59 | |
luqui | look at it for for: | ||
for @a <-> $x { $x++ } | |||
@a goes into $x, then $x goes back into @a | |||
leo is pondering if perl6 {is,will be} released today;) | 23:00 | ||
Juerd | That Larry doesn't To: people makes finding answers to your own message hard. | ||
Normally I'd ~f larry ~t juerd ~b context | |||
(I've stopped To:'ing people myself too, though) | |||
luqui | leo, yes | ||
obra | leo: no ;) | ||
luqui | hehe | ||
avar | luqui: could I do for @a ā $x { ++$x } ?;) | 23:01 | |
Juerd | luqui: Message-ID: [email@hidden.address] | ||
luqui: And thread | |||
dduncan | I never To: people myself if they're on the mailing list | ||
when people do that to me, I get 2 copies | |||
Juerd | dduncan: Which really is better. | 23:02 | |
dduncan: But it does make finding replies harder. | |||
dduncan | I just look at all the replies to threads I participate in | ||
luqui | avar, you might have to declare that yourself | ||
dduncan | particularly ones I start | ||
Juerd | As searching has no threading functionality. | ||
dduncan: Yeah, but that isn't quite a viable alternative to searching archives | |||
luqui | unless that symbol is latin-1, in which case we might (but probably won't) make it a synonym | 23:03 | |
Juerd | dduncan: Mind you, of the over 7500 p6l messages in this mailbox, I wrote over 600 | ||
dduncan | so I always To my list responses to the list itself and only that ... most of the time ... | ||
I only add a To for a specific person in rare chances I want it to stand out to them / have them see it sooner | 23:04 | ||
luqui | Juerd, but brent has a good point | ||
not a great point | |||
dduncan, I wonder if that works | 23:06 | ||
Juerd | luqui: It's a good point indeed. | 23:07 | |
dduncan | with some mailers, they format a message list so that direct mails stand out more than indirect mails | ||
Juerd | luqui: But it's a definition without argumentation. *why* nouns? I agree that if any one is a noun, they should all be. | ||
But they can also all by adjective. | |||
avar | ?eval "Ʀ" | 23:08 | |
evalbot_8423 | *** unexpected "(" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input at -e line 15, column 6 | ||
Juerd | In fact, since the main contexts both (excluding void) have the same tree of types underneath, adjective may make sense. | ||
avar | ?eval say "Ʀ" | ||
evalbot_8423 | *** unexpected "(" expecting term postfix, operator, postfix conditional, postfix loop, postfix iteration, ";" or end of input at -e line 15, column 6 | ||
avar | ... | ||
?eval 1+1 | |||
evalbot_8423 | 2 | ||
Juerd | "singular Dog context", "plural Dog context" | ||
avar | ?eval "\303\246" | ||
evalbot_8423 | "\d[303]\d[246]" | ||
avar | odd | ||
?eval "\303\246".perl | 23:09 | ||
evalbot_8423 | "\"\\d[303]\\d[246]\"" | ||
Juerd | avar: Please try such things with pugs directly. Use the evalbot if you want to show the channel something specific. | ||
avar | Trying to figure out if there is something to show;) | 23:10 | |
Juerd | I just had a toilet revelation | 23:19 | |
item context should be "one" context. | |||
With a low precedence "one" operator, and a high precedence "1" operator. | |||
"1", the number, differs from "1", the operator, in that it has 0 arguments. | |||
And 1foo is unambiguous because it's an invalid identifier anyway | 23:20 | ||
Ignore all that :) | |||
Toilet revelations aren't the greatest anyway | |||
luqui: A bare closure should just start iterating if it gets any input lists. | 23:21 | ||
luqui: { @foo.push: $x + $y if condition and condition } <== @x, @y; | 23:23 | ||
Though where exactly $x and $y come from, I don't know ;) | |||
nothingmuch | $^x and $^y ? | ||
Juerd | Oh, of course, they're $^y and... what nm said :) | ||
Hm | 23:24 | ||
nothingmuch | this concludes mmy helping pugs today ;-) | ||
Juerd | comprehend { $^x + $^y } <== @x, @y, { condition }, { condition }; | ||
nothingmuch | now i'm off to sleep.... i'm frozen stiff from a walk in the rain | ||
Juerd | nothingmuch: Awww | ||
nothingmuch | it was voluntary | ||
i *like* the rain | |||
we get it very seldom | 23:25 | ||
Juerd | nothingmuch: Still, I wish to you a warm evening | ||
nothingmuch | thank you =) | ||
Juerd | I absolutely hate rain. | ||
We have way too much of it. | |||
nothingmuch | it's always like that =) | ||
Juerd | It's unfortunate that weather can't be exported easily. | ||
Other natural resources, like gas and oil, can. | |||
nothingmuch | if we had a lot of rain i wouldn't have liked it either ;-) | 23:26 | |
dduncan | ?eval sub bar () { my %foo = (4=>5); return { %foo }; } say bar(); | ||
evalbot_8423 | OUTPUT[45 ] bool::true | ||
Juerd | No, but a healthy world market would balance things out a bit :) | ||
nothingmuch | hehe | ||
then the US would try to attack seattle | |||
Juerd | Haha | ||
dduncan | ?eval sub bar () { my %foo = (4=>5); return { %foo }; } say bar().ref; | ||
evalbot_8423 | OUTPUT[Hash ] bool::true | ||
Juerd | dduncan: Do you have a local pugs installation? | 23:27 | |
dduncan: Or access to feather? | |||
dduncan | yes | ||
but in my situation, its treating the sub's return value as a block | |||
Juerd | dduncan: Please use that. Or, if you were trying to make a point, don't forget the point itself. | ||
luqui: How about: comprehend { $^x + $^y } <== @x, @y, { condition }, { condition }; | 23:28 | ||
Ehhh | 23:29 | ||
luqui: How about: comprehend { $^x + $^y } <== @x <== @y <== { condition }, { condition }; | |||
luqui: It'd be nice if there was a way to carry lexicals out of a block. | 23:30 | ||
luqui: Because $^apple doesn't sort well with $^pear, if @pear was the first input list | 23:31 | ||
luqui: Or maybe this all just means we need postfix ->, then <-, as well. | 23:33 | ||
luqui: comprehend { $x + $y if condition } <- (@x; $y); | 23:34 | ||
luqui: Which for all I care, can just replace map. map { $x + $y if $x > 10 } $x, $y <- (@x; @y); | 23:35 | ||
luqui: Though I'd write it args-first: map (@x; @y) -> $x, $y { $x + $y if $x > 10 } | |||
I think that's nice enough syntax to work with :) | |||
Hm, no, map of course walks arrays in parallel | 23:41 | ||
comprehend then. | |||
It's a shame -> can't be placed in the middle of something. | 23:42 | ||
@foo -> $foo, @bar -> $bar feels more logical, syntax wise, than @foo; @bar -> $foo, $bar | |||
dduncan | okay, here's a demo of the problem ... | 23:43 | |
?eval class M { has %!h; submethod BUILD () { %!h = (4=>5); } method geth () { return { %!h }; } } class T { method tra ($m) { .useh( $m.geth() ) } method useh (%h) { say "got {%h}"; } }; my $gm = M.new(); my $gt = T.new(); $gt.tra( $gm ); | |||
evalbot_8423 | OUTPUT[got <SubBlock(<anon>)> ] bool::true | ||
dduncan | that's distilled from the actual failing code | ||
what I demo'd earlier, a simpler case of the same, does work | |||
so I'm trying to figure out what to fix in the newest example so that the copy of %!h gets to useh() intact | 23:44 | ||
Juerd | Hmmm | ||
dduncan | but somehow it becomes an anon block | ||
Juerd | What if -> (and <-> of course) would just declare parameters for "the next bare block" | 23:45 | |
And without statement control keyword, it'd just pre-alias | 23:46 | ||
avar | $ ghc -v | ||
Glasgow Haskell Compiler, Version 6.4, for Haskell 98, compiled by GHC version 6.2.2 | |||
\o/ | |||
no more 5.* ;) | |||
Juerd | $foo + $bar -> $x; $xyzzy * $quux -> $y; { $x + $y }; | 23:47 | |
There's VERY little point in that, though. | 23:48 |