svn switch --relocate svn.openfoundry.org/pugs svn.pugscode.org/pugs/ | run.pugscode.org | spec.pugscode.org | paste: sial.org/pbot/perl6 | pugs.blogs.com
Set by avar on 16 November 2006.
00:02 mako132_ joined 00:17 awwaiid joined, bonesss joined 00:28 rlb3 joined 00:43 whooosh joined 00:57 thepler joined 01:43 scw joined 01:59 mako132_ joined 02:03 whooosh joined 02:21 mako132_ joined 02:49 mako132_ joined 02:58 jferrero joined 03:21 n0ps1d joined 03:40 sweinig is now known as sweinig|zZz 03:47 stevan_ joined 04:04 H0LE joined 04:31 justatheory joined 04:35 Ickyshuffle joined 04:38 nopsid joined 05:19 scw joined 05:31 nopsid joined 05:36 Ickyshuffle joined 06:13 [particle] joined 06:15 BooK joined 06:17 nopsid joined 06:28 H0LE joined 06:29 TreyHarris joined, badalex joined, autark_ joined, Eidolos joined, bcorn_ joined, silug joined, pasteling joined, Gothmog_ joined, smash_ joined 06:48 nopsid joined 07:06 scsibug_ joined 07:18 nopsid joined 07:23 dduncan joined 07:35 H0LE left 07:58 jabbot joined 08:25 boo is now known as beu 08:42 iblechbot joined 09:01 sweinig joined, TreyHarris joined, badalex joined, autark_ joined, Eidolos joined, bcorn_ joined, silug joined, pasteling joined, Gothmog_ joined, smash_ joined 09:13 SamB joined, Southen joined, sweinig joined, iblechbot joined, jabbot joined, dduncan joined, BooK joined, [particle] joined, justatheory joined, nicodaemos joined, gnuvince joined, miyagawa_ joined, marmic joined, spoop joined, shadowspar joined, qmole joined, baest joined, penk joined, frankg joined, slanning joined, kanru joined, Patterner joined, SCalimlim joined, Yappo joined, drbean_ joined, sri___ joined, lambdabot joined, AzureBOT joined, gantrixx joined, GabrielVieira joined, orafu joined, mj41_ joined, Khisanth joined, buu joined, bennymack joined, jrockway joined, evalbot_r14767 joined, svnbot6 joined, mugwump joined, buubot joined, dbrock joined, ofer0 joined, nekokak__ joined, ruz joined, integral joined, mako132 joined, webmind joined, pmichaud_ joined, plural joined, leo_ joined, chip joined, Juerd joined, audreyt joined, wolverian joined, xinming joined, eviltwin_b joined, spo0nman joined, f0rth joined, puddingpimp_work joined, perlbot joined, mdiep joined, PerlJam joined, pdcawley joined, norageek joined, sjn joined, idiotmax joined, kane-xs joined, wilx joined, revdiablo joined, meppl joined, takesako joined, takanori_ joined, cognominal joined, hcchien joined, tcliou joined, jiing joined, nine joined, Ikarus joined, nipotaway joined, kolibrie joined, pnu joined, Maddingue joined, Shabble joined, broquaint joined, nnunley joined, kcwu joined, rafl_ joined, cj joined, Debolaz joined, rgs joined, knewt joined, spinclad joined, GeJ joined, cmeyer joined, LCamel joined, cookys joined, masak joined, dvorak joined, prism joined, beppu_ joined 09:23 Lorn joined 09:40 elmex joined
nothingmuch audreyt: i need some advice 09:58
MO is going to be bootstrapping itself soon
09:58 larsen_ joined
nothingmuch through .pmcs 09:58
audreyt so not dep on oldMoose anymore?
lambdabot audreyt: You have 2 new messages. '/msg lambdabot @messages' to read them.
audreyt @massages
lambdabot Limbic_Region said 1d 10h 39m 7s ago: Win32 hangs smoking on t/perl5/modify_inside_p5_p6.t
fglock said 20h 20m 53s ago: see r14779
nothingmuch for development of MO itself I need two versions in %::
one is Moose MO, and one is MO MO 09:59
and of course, later, i need to keep a stable copy of MO MO
in .pmc form
audreyt sure
nothingmuch fortunately since MO is not very strict about package naming i can do that fairly easily by using class transforms
and renaming the class in the registry
but it can get nasty 10:00
audreyt you can also use pugs.blogs.com/pugs/2006/06/multive....html#more hack
lambdabot tinyurl.com/yxeyae
audreyt which enables caller-sensitive symbol processing
nothingmuch yes, that's what I wanted to ask =)
audreyt it should be fairly self explanatory
nothingmuch aye
audreyt 23:04 <@gnat> I have no joke here, I just like to say "first you simply swap out the entire symbol table." 10:01
nothingmuch i'm more interested in what you're doing at load time
e.g. how do you load two Foo.pms as Foo1 and Foo2
audreyt easy
load Foo 10:02
nothingmuch load and then hijack?
audreyt %Foo1:: = %Foo::
nothingmuch oh right i can actually do this with an inc hook
nevermoose =)
audreyt Symbol::delete_package('Foo')
yes, or hijack CORE::require
nothingmuch Foo::Bar will also be moved to Foo1::Bar, right?
audreyt it's trivial :)
yes.
nothingmuch okies
lastly, do you know of a good way to force load the .pm if a valid .pmc exists? 10:03
eval "#line 1 $INC{$file}\n" . do { local (@ARGV, $/) = $INC{$file}; <> }; # FIXME YUCKYUKCYUCKCKCKCKC
audreyt via INC hook you can hijack search algo.
nothingmuch }
that's what I do now
avar suggested inc hook
aye, but that is deeper than that
the .pmc overload is at the open stage
doopen_pm
not the search
i can use my own FH 10:04
audreyt you just pass content
nothingmuch but that's not much different
audreyt no pseudo fh required
nothingmuch is that new?
audreyt do a @INC file search yourself
no it's just undocumented.
nothingmuch ... ;-) 10:05
audreyt # Return all contents line-by-line from the file inside PAR
my @lines = split(
/(?<=\n)/,
$zip->memberNamed($filename)->contents
);
return (sub {
$_ = shift(@lines);
return length $_;
});
that's how PAR used to do its job
nothingmuch ah
audreyt thoroughly undocumented although dependable on 5.6+ 10:06
nothingmuch coolness 10:07
audreyt "we no longer write games in perl because perl itself is the game" etc
nothingmuch hehe 10:08
return length $_? not return length @lines or something? 10:11
or will it stop when $_ becomes undef?
audreyt the latter 10:12
I took that from Acme::use::strict::with::pride
which actually is a good model for you to adapt from 10:13
nothingmuch bah, it becomes /loader/0x18c332c/examples/Point.pm 10:14
audreyt #line
as $lines[0] 10:15
nothingmuch erm 10:16
yeah
no diff than what I was doing before, really ;-)
audreyt so, exactly same as A::u::s::w::p
well, a bit different
the eval call stack is "right"
nothingmuch ah'
audreyt unlike manual ppeval
nothingmuch fair enough
ughghghg 10:26
weird compilation errors from nowhere
syntax error at examples/Point.pm line 24, near ":"
audreyt did you empty $_? returned 0 eventually?
nothingmuch yes 10:27
i have warn $i++ . ": $_"; in the returned sub
audreyt uhm. try some voodoo debugging 10:28
I can't actually focus on code now, sorry
pasteling "nothingmuch" at 84.108.53.74 pasted "output" (43 lines, 1.7K) at sial.org/pbot/21210
nothingmuch okay
thanks =)
audreyt np :) 10:29
nothingmuch goes back to the old method 10:32
leaving the new one commented as "# this is more correct but doesn't work" ;-) 10:33
10:38 dduncan left 10:51 polettix joined 10:55 Belaf joined 10:57 iblechbot joined 11:14 chris2 joined 11:25 xinming joined 11:38 buetow joined 11:50 SCalimlim joined 12:05 elmex joined, TimToady joined 12:30 Psyche^ joined 12:37 sweinig is now known as sweinig_, sweinig_ is now known as sweinig 12:38 ludan joined 12:42 jferrero joined 12:46 Psyche^ is now known as Patterner 13:00 eggzeck joined 13:01 b00t joined
xinming anyone here would help me clarifying what does term mean? 13:16
I'm reading synopsis. And find the word term... 13:17
svnbot6 r14788 | audreyt++ | * add back movies.html to pugscode.org 13:21
nothingmuch 's brain froths 13:22
xinming: a syntactic unit
that's a bit vague
generally... a variable, or a function call, or something like that 13:23
audreyt a term is a subexpression that can also be a valid expression in itself
nothingmuch i think the line is "an expression that has a value" is a term
audreyt as opposed to an operator, which needs terms to be operated on
and are not valid expressions in itself
"that has a value" is a good explanation too
nothingmuch but far less precise =)
audreyt it's actually isomorphic :) 13:24
nothingmuch hmm
fair enough
audreyt: i have a far more sane bootstrap plan, btw 13:25
.pmc MO compiles to bootstrap::MO::Compile::Class etc
.pmc MO compiles non .pmc MO, that is
and then right before the DDS dump it does 'local %{"MO::"} = %{"bootstrap::MO::"} 13:26
audreyt aha
clevar
nothingmuch aye
audreyt nothingmuch++ # clavar
nothingmuch and it's a very simple trick in MO::P5::Registry
audreyt excellent plan if DDS doesn't use MO :) 13:27
which it has no reason to
so very safe
cool hack.
nothingmuch well, theoretically it still works
because bootstrap::MO::* is compiled, after all
so even if we swap the MO version underneath, it should still work 13:28
bar api incompatibilities
audreyt provided it's api compatible
which you can't guarantee at that stage
nothingmuch only the first version of DDS doesn't need to use MO =)
audreyt it's stage1
right =)
nothingmuch (woohoo! it doesn't ;-)
audreyt ok. looking forward to crossgenerate native p6 class in both runcores :)
nothingmuch++ # right mix of insanity and cleverness 13:29
xinming Ok, so term is a subset of expression which can be expression itself, right? :-P
nothingmuch current plan: .pmcify the moose incarnation of MO
(the .pmc generating code wouldn't know the diff anyway)
audreyt xinming: not subset, "part of"
xinming: "1" is part of "1+2"
13:29 BrendaSexy joined
nothingmuch and then incrementally swap out Moose based impl with a MO based one 13:29
xinming audreyt: thanks.
audreyt: How to say 'term' in Chinese? 13:30
audreyt yup. sane plan
xinming: zh-cn? 13:31
xinming audreyt: zh-tw is ok
audreyt U+9805 I think is -cn
xinming ꈑēš„ę„ę€ę˜Æꀎéŗ¼ēæ»č­Æ怂 13:32
:-)
nothingmuch i hope you had to use a reference
audreyt xinming: U+9805 :)
xiang
項
xinming Ok...
thanks.
audreyt xinming: I think č©žå½™ is zh-tw 13:36
you can combine both to make č©žé … 13:37
which I think is the best translation
I think č©žé … is also used in classical logic textbooks
so go ahead with that
operator = ē®—ē¬¦, operand = ē®—å…ƒ, expression = 陳čæ°å¼ (zh-cn simply has it as "式" I think) 13:38
zzz *wave* & 13:40
xinming audreyt: thanks 13:41
operator = ę“ä½œē¬¦ļ¼Œ operand = ę“ä½œå°č±”, expression = č”Ø達式ļ¼Œ :-) 13:42
nothingmuch i hope you had to use a reference 13:46
xinming nothingmuch: Most books in mainland are from TaiWan. 13:48
:-)
nothingmuch i meant i hoped that audrey didn't remember U+9805 from memory
then I thought IRC was my terminal and hit up, enter
xinming ... 13:49
How to type uncide?
eg, give you a number.
how to type that?
nothingmuch no 13:50
that the word for 'term' is unicode number blah blah blah
it's inhuman to know unicode numbers by heart
13:50 mdiep joined
xinming But she is super-woman.. ;-) 13:50
nothingmuch that was the joke =)
13:55 eggzeck joined
nothingmuch w 19 13:58
14:05 mdiep joined
smash_ good day 14:06
14:35 sweinig is now known as sweinig|bbl, turrepurre joined
Belaf Hi all! I've got a question: willing to play a little bit with pugs, should I get Perl6-Pugs-6.2.13 from CPAN or is it any better try to stick with the latest SVN ? 14:46
Patterner latest imho 14:47
Belaf Thanks Patterner. Does this mean SVN head is stable (still, just for playing :)) enough? 14:49
Patterner why do you care about stable anyway? :)
for playing it's good enough 14:50
Belaf Well, in some cases things from repository heads are not even meant to be compilable. Glad to hear it's not the case :). Thanks a lot! 14:51
14:53 SCalimlim joined 15:14 thepler joined
nothingmuch YAY 15:17
MO::Compile::Field::Simple is now written in MO
and Simple.pm.boot is written in Moose, and is used to compile itself 15:18
and the resulting Simple.pmc can replace the moose written Simple.pm.boot 15:20
15:40 turrepurre joined 16:03 H0LE joined 16:04 IndyBC joined, IndyBC left 16:18 eggzeck joined 16:29 sweinig|bbl is now known as sweinig 17:00 beu is now known as immortalbeu 17:02 immortalbeu is now known as beu 17:15 lisppaste3 joined 17:19 f0rth joined, buu joined, qmole joined 17:27 thepler joined 17:28 gnuvince joined, penk joined, frankg joined, buubot joined, ofer0 joined, perlbot joined, Limbic_Region joined 17:29 sweinig is now known as sweinig|food, frankg joined, ofer0 joined 17:35 penk joined 17:36 buubot joined 17:38 nopsid joined 17:45 fglock joined 17:49 turrepurre joined
svnbot6 r14789 | fglock++ | MP6 - bootstrapped compiler generates stable code (compiled == previous) 17:54
r14789 | fglock++ | - autoquote hash keys { a => 42 }
r14789 | fglock++ | - pair syntax sugar { :$a }
17:55 fglock joined
fglock audreyt, nothingmuch: ping? 17:57
18:08 nopsid joined 18:12 mako132_ joined 18:19 mako132_ joined 18:24 sweinig_ joined
nothingmuch @tell fglock /msg me when you're back and I'll backlog if it helps 18:35
lambdabot Consider it noted.
nothingmuch nobody in particular: 18:36
the constructor protocol for MO, as I see it, in the default class is going to be:
Class->create_instance( $meta_field => $value ); # low level constructor, interfaces with layout directly
this can be used to serialize objects without knowing their representation format, for example
and then around that Class->new 18:37
which will take the params
hand them to every attribute
expecting back a list of field/value pairs
which it gives back to create_instance
then it calls BUILDALL
does that make sense?
in Perl 6 the semantics are slightly different, as the various BUILD methods actually handle the attr initialization, IIRC 18:38
that's more difficult to inline, though
(in p5 space)
18:41 gnuvince joined 18:56 rodi joined 19:08 mako132_ joined 19:15 elmex joined, araujo joined 19:19 rindolf joined
rindolf Hi all. 19:19
19:31 sweinig_ is now known as sweinig 19:32 sweinig is now known as sweinig|bbl 19:39 frost joined 20:01 sweinig|bbl is now known as sweinig 20:09 Corion joined, Corion left 20:11 Captain_Fourier joined
Captain_Fourier hello 20:11
20:27 mdiep joined, Aankhen`` joined 20:34 Aankhen`` is now known as TR0LL, TR0LL is now known as Aankhen``
rindolf Hi Captain_Fourier 20:35
Captain_Fourier wwhere can i get a good tutorial on p6
audreyt Captain_Fourier: www.programmersheaven.com/2/Perl6-FAQ 20:37
lambdabot Title: Perl6-FAQ at Programmers Heaven
rindolf Hi audreyt 20:39
audreyt hi. just woke up and going to sleep again
audreyt is still sleeping in <5hr chunks
gnuvince Has anyone ever experienced an out-of-memory problem compiling pugs? 20:40
gaal I forget. 20:41
gnuvince: vi config.yml and tweak the ghc heap setting.
audreyt gnuvince: or just "make" again 20:42
20:42 mdiep joined 20:46 dduncan joined 21:03 anatolyv joined 21:23 eggzeck joined
dduncan seen stevan_ 21:34
jabbot dduncan: stevan_ was seen 262 days 23 hours 14 minutes 59 seconds ago
dduncan are there any Moose people on the list now? 21:35
I have a few questions or suggestions that may help improve Moose
Debolaz dduncan: He's in #moose @ magnet. 21:36
dduncan actually, that just came to mind ...
I knew there was a #moose channel, but not what IRC server it is on
stevan_ dduncan: whats up 21:37
Debolaz Apparently, also here. :-) 21:38
stevan_ hey Debolaz :) 21:39
Debolaz Heya.
Debolaz is about to head off to work to start a new project which will be using Moose.
stevan_ is babysitting a partially-automated data import script :) 21:40
dduncan oh you are here 21:41
stevan_ dduncan: yup :) 21:42
dduncan stevan_ , this concerns type constraints
first, the question ...
in your Moose::Util::TypeConstraints, I notice that 'Str' and 'Int' and 'Num etc assert that the given value is not a reference type 21:43
stevan_ yes, this is to model p5
dduncan however, what would this do if someone wanted to use a BitInt or BigNum etc type that are bundled with Perl?
I mean, BigInt
stevan_ isa => 'BigInt' 21:44
dduncan presumably, Perl 6's numbers are based on those so to have arbitrary precision
stevan_ assuming that a $bigint->isa(BigInt)
dduncan that isn't what your "subtype 'Int"" contains
stevan_ dduncan: the Moose type constraint system does not try to emulate p6's type system 21:45
only p5s
a BigInt in p5 is a overloaded class
which is (at it's core) a reference
dduncan so the 'Int' you predeclare is explicitly not big, just what a normal Perl 5 SV can hold?
stevan_ yup
dduncan I would have thought the default 'Int' ought to accept either an SV int or a BigInt 21:46
stevan_ I pondered trying to model p6 types, and Moose::Autobox was where I was experimenting with it
dduncan since both act like an int
stevan_ dduncan: well yes, in theory 21:47
dduncan but you decided in practice that this was bad?
stevan_ but in practice it is very hard to do that and still be efficient
no, it would be good
I agree with you
the problem is that there is no way to say $thing->does(Num)
which a BigInt would most likely do 21:48
unless of course autobox was involved, and even then it gets very tricky
dduncan fyi, for context, I made this as a utility for my database-implementing module: darrenduncan.net/QDRDBMS/GSTV.pm 21:49
stevan_ dduncan: a more pluggable type system for Moose is on the todo list 21:50
dduncan in the process of doing that, I noticed that what it does is similar to what the Moose TypeConstraint is for
stevan_ not far below the performance enhancements and roles fixes
dduncan basically provide a simple way to constrain the creation of a Perl scalar to within a particular domain
stevan_ yes, they looks very similar 21:51
ideally I would like for people to be able to use thier favorite type-checking/validation modules for Moose type constraints
dduncan I thought about explicitly checking for !ref, to ensure a built-in, but then thought to not assert !ref to give users more flexability
stevan_ Params::Validate comes to mind
I think Alias has one out there too 21:52
and you could certainly use this as well
dduncan if I try using the input in a numeric context and it auto-coerces to what looks like a number, then presumably the user knows what they're doing ... more importantly, the user of my constraint-checked value can be confident that what they think is tested to be eg a number will in fact be useable like a built-in one 21:53
now, a suggestion ...
since newer Perls, 5.8 at least, have a distinct concept of SV strings being either characters or bytes, via the utf-8 flag ... I suggest that Moose have distinct Str and Blob TypeConstraints which check that the strings are being interpreted as desired 21:55
because otherwise, bytes with the 8th bit set are ambiguous
21:55 frost left
dduncan if a string is not in character mode, and the 8th bit is set, and you try to use the string as a character, it may autocoerce using the wrong character set ... 21:56
stevan_ dduncan: well I am still trying to keep 5.6 support right now
I might have to ditch that soon though, depending on the way the .pmc stuff works out
dduncan probably latin1 or something ... and I personally like to use utf8
so by having distinct Str and Blob constraints, we require users to have already explicitly disambiguated their data before we get it, so our users can then consider it unambiguous 21:57
stevan_ dduncan: its out my realm of expertise though, so if you want to supply a patch, I would be happy to apply it
dduncan if the string is character mode, then we know the users already dealt with determining what character set it is 21:58
the file I pointed you to already has the test I've been using ... you could lift it from there
or since I don't use actual patches much, I can send you the text of the replacement/new functions and where they go, which you can manually insert 21:59
they're very short, afaik
stevan_ dduncan: that works 22:03
like I said, I wont be getting around to this until after the other two big items on the todo list 22:05
pasteling "dduncan" at 24.69.53.198 pasted "revised Str and new Blob TypeConstraint for Moose" (9 lines, 303B) at sial.org/pbot/21219 22:06
dduncan okay, see if that helps you
stevan_ and at that point it might actually make more sense for me to just write a plugin to use your module for type constraints instead :)
so a Blob is a non-utf8 string? 22:08
22:08 mako132_ joined
dduncan you could, but the module of mine that I pointed you to is extremely simple, and meant mainly to help bootstrap my QDRDBMS framework under Perl ... and the framework is deprecated in favor of a Perl 6 version ... you should just copy any code you find useful 22:09
a Blob is a byte-oriented string
which is what you have if the utf8 flag is turned off on an SV
afaik, byte-oriented is how Perl 5 works by default, such as when you've read in file data 22:10
if you haven't done something like ...
this first: binmode *main::STDIN, ':utf8'; 22:11
stevan_ ok
dduncan if you did that, then the file input should be character-oriented
stevan_ I might switch the names a bit, since the default in p5 is closer to Blob then Str
maybe Str and UnicodeStr 22:12
something like that
dduncan I used the names Blob and Str for bytes and chars because that is the meaning of the same-named Perl 6 types
I was unsuccessful in getting character strs renamed to something more character-meaning like Text
but at least Blob got added as a separate item 22:13
22:13 jferrero joined
stevan_ cool, I have to run, but thanks for the patch :) 22:13
dduncan still, you can name them what you think best ... the important thing is to have the 2 distinct types with their distinct character-mode vs byte-mode semantics
22:14 larsen_ joined 22:27 awwaiid joined, perlbot joined
nothingmuch dduncan: moose doesn't do any string operation s 22:29
it should be as pass-through as possible
or we risk interfering with existing code that is also pass-through 22:30
and most perl 5 code is
when it comes to utf8 strings
dduncan the type constraint utilities are optional, and users only use them if they want those constraints 22:32
nothingmuch yes, but Str means one thing to most perl users: either utf8 or a bytestring
dduncan afaik, the "utf8" name is a misnomer ... it really means character-mode vs byte-mode
nothingmuch by that rationale you can make a custom constraint pair, UnicodeString and Buf or something like that 22:33
you know what i meant =/
dduncan so you are saying that Moose's "Str" type should be the union of byte and char types? ...
and have 2 new names to be constrained to one?
if so, that's reasonable 22:34
nothingmuch yes
and that they should probably not be available by default to keep confusion down
dduncan so then, I suggest naming them "Str", "Text", "Blob"
nothingmuch people who actually need the distinction on that level are probably better off implementing them themselves
because generally code bases like that tend to have at the very most one layer that actually does octet <-> character conversion 22:35
22:35 spoop joined
dduncan yes, but it is a best practice to include utilities for what users are going to write again and again when using your module 22:35
nothingmuch and even then it's usually just pushed to PerlIO
that's what I'm saying
that 99% of the users won't write it even once
dduncan well the addition I suggested doesn't actually do any character conversion, it just asserts whether the user already did that or not
so users still do their own conversion 22:36
nothingmuch i get that, that's not what I'm adressing
dduncan I see my proposal of checking character/byte mode as being no different from distinguishing number-mode or int-mode from either
nothingmuch it is a little different 22:37
dduncan it is a natural fit, and no more complicated
nothingmuch the reason it is that strings can be upgraded in place
and that sometime non i18n aware code is used in i18n aware code
and due to their isomorphism it Just Works
dduncan the fact we assert Num or Int or whatever is that the user wants to treat a weak type as a strong type
nothingmuch no
there are things that are not Num, but only Int 22:38
like indices
or cardinal values
dduncan yes
nothingmuch that is not a "pass-through" in that sense
Num vs. Int is like the difference between Str and \w+
dduncan question ...
nothingmuch ...? 22:40
dduncan Perl 5's hash keys ... when you say "$hash{$scalar} = $something;", I know that $scalar is coerced to being defined and a string not a num, but is it coerced to byte or character mode?
nothingmuch that depends 22:41
if $scalar stringifies via overloading, then whatever that was
if not, then it's a bytestring
unless it already was a unicode string
dduncan eg, if you stick a key in a hash that has a particular utf8 flag, will that flag be preserved when you use .keys?
nothingmuch yes
hash keys are not true scalars 22:42
but they do know the utf8ness
utf8 strings have a negative length
IIRC
of course, this is not exposed, just used internally to tell them apart within the specific table
www.perl.com/pub/a/2000/12/p5pdiges...01210.html 22:44
dduncan so if you say $hash{'Perl'} and $hash{'Perl'} where one of those strings has utf8 on and the other off, will they match?
lambdabot Title: perl.com: This Week on p5p 2000/12/10, tinyurl.com/y4ojss
dduncan s/Perl/<any arbitrary string>/
nothingmuch that's a good question 22:45
dduncan or not
nothingmuch i'm not sure
you can test it with use utf8;
dduncan that's part of the crux of the matter
in a strong typed system, 'Perl' with the flag on and 'Perl' with the flag off are distinct types
nothingmuch for ascii it is the same
dduncan distinct values I mean
nothingmuch prolly
pasteling "nothingmuch" at 84.108.53.74 pasted "utf8 test" (24 lines, 190B) at sial.org/pbot/21220 22:46
"nothingmuch" at 84.108.53.74 pasted "output" (5 lines, 116B) at sial.org/pbot/21221 22:47
nothingmuch pretty much what i expected
dduncan fyi, the reason my example Str test that I passed Stevan checked for higher bits is, afaik, the "use utf8;" pragma of Perl 5 will only actually set the flag true for strings that contain non-ascii values
nothingmuch if utf8 is required to represent the charstring then they are district
distinct
could be
remember that perl will automatically upgrade non utf8 strings when they are e.g. concatenated with utf8 strings 22:48
anatolyv dduncan: you can test with explicit utf8::upgrade etc.
dduncan so "$foo = 'Perl'" will always have the flag off, even under the utf8 pragma ... I discovered this through working with it
nothingmuch yes
becasue that's how perl is
dduncan nothingmuch, yes that upgrade will happen 22:49
nothingmuch the conversion only happens when needed
anatolyv dduncan: whether two hash keys with ascii values work the same w/ and w/o the utf-8 flag in them
avar does p6 have $str[range] ?
nothingmuch 0
uj
avar: yes, I believe that Str does Array
dduncan but if a $str, say read from a file in byte mode, contains 8-bit latin1, it will be upgraded as such, even if the file is some other encoding ... hence the auto-upgrade did the wrong thing
nothingmuch or that in fact Array of Char does Str ;-) 22:50
dduncan: yes
dduncan or should I say, the file contains 8-bit anything, it will be treated as latin1
avar ?eval my $str = <abc>; $str[0]
22:50 evalbot_r14767 is now known as evalbot_r14789
evalbot_r14789 \"abc" 22:50
nothingmuch avar: that's an array ref in $str
dduncan hence my Text-type flags 8-bit value input with the flag off as an error, since it is ambiguous, and a subsequent auto-upgrade may do the wrong thing
nothingmuch ?eval my $str = 'abc'; $str[0]; # probably won't work 22:51
evalbot_r14789 \"abc"
nothingmuch dduncan: what business is it of Moose's?
anatolyv ?eval my $str=<abc>; $str[0..1]="12"; $str;
evalbot_r14789 Error: Can't modify constant item: VStr "abc"
anatolyv doesn't do Array then
nothingmuch not yet anyway
anatolyv just does post_circumfix:<[ ]>
nothingmuch anatolyv: bot not DWIM 22:52
dduncan: my original point was that a system typically implemented in moose, a reusable one, will take strings of any type
and maybe combine them, or process them, or whatever
and emit back strings of the same type
anatolyv nothingmuch: don't think it should, Str is immutable.
dduncan I brought up this business for Moose because the problem I was addressing seemed generic to any Perl program that deals with text, and since Moose had a default set of type constraints, I felt the distinction would do well to be included for the benefit of all Moose users
nothingmuch that's how perl's utf8 was plugged in 22:53
most code ignores the distinction, and subsequently Just Works
22:53 BooK joined
nothingmuch and for code where that distinction is needed, code that does the actual IO or the layer right after it, precooked things are typically just not clear enough 22:53
dduncan yes, but having it in Moose adds extra sanity checks, in case the user forgot to do the right thing at IO time 22:54
nothingmuch returning to my original conjecture that when this is an issue it is typically not handled by moose type constrains
but *why*?
consider a user class
dduncan I still see the matter as being analagous to the difference between characters and numbers ... even if you don't
nothingmuch package User; has name => ( isa => "..." ); # which is correct here?
i think you just haven't dealt with utf8 strings in practice enough 22:55
dduncan names are characters
nothingmuch sorry, bullshit
because 99% of the strings that will be fed to it won't be unicode aware
it's not a perfect world =(
dduncan the world not being perfect is a red herring
nothingmuch in fact, typically youc an give it a utf8 bytestring, and it will *still* work correctly 22:56
because unless you:
substring
use length()
use regexes
there's no real difference
and because there is no real difference on that level barely any code makes that distinction
and hence code that enforces this check will simply not play well with others
and confuse the hell out of any user who isn't used to i18n 22:57
dduncan generally, byte mode is appropriate for binary data like random files, or image or sound data etc ... character mode is for text, including people's names, addresses, descriptions, etc
nothingmuch i know, i know
remember that I'm not a native english speaker
hebrew is one of the languages with the most crappy encodings in existence
dduncan and character mode is encoding-agnostic
nothingmuch i know
but IO isn't
dduncan well thats a separate issue 22:58
nothingmuch and 99% of the time even if it was supposed to be character mode
and even if it is non ascii
it won't be
dduncan in any event, I already agreed with having separate Str, Text, Blob
nothingmuch that's just how it is
you don't get it =(
putting that in moose is just adding 2 more types
that most users don't know the difference between
and that almost all users will never actually need to distinguish 22:59
dduncan and for those that do, more power to them
nothingmuch and more docs
and more confusion
and more subtle bugs
it's overengineering
dduncan well, if you believe strongly in doing things a certain way, more power to you ... and if you're a Moose developer, it will probably be done your way too ... so be it 23:00
nothingmuch you're still missing the point, sorry =(
dduncan in any event, my continued work in Perl 5 is deprecated until I can work in Perl 6 full time, at which time all of this will be moot 23:01
for me
nothingmuch fair enough
dduncan fyi, my Perl 5 framework is named "Quick and Dirty ..." on purpose, because it is only meant to be a stand-in for people to use until the Perl 6 version is ready
nothingmuch perl 6 won't be quirk free 23:02
it's only a matter of time
dduncan so I'm just making something that works for a DBMS now, and for that task, stronger distinguishing for data types is important
nothingmuch i'm nto saying the distinction is wrong 23:03
but not every user writes a DBMS support layer
that worries about string representations
dduncan yes
dduncan well, back to work
nothingmuch enjoy 23:04
dduncan P.S. If stevan hasn't read our exchange, you may want to talk him out of using what I sent him 23:05
nothingmuch he asked me what my opinion was, so i came here to make some noise ;-) 23:06
dduncan if he hasn't already decided the same as you by himself
nothingmuch btw, for what it's worth I do think a MooseX::MoreConstraints or somesuch module could contain this and more
that way it's reusable, but not adding more conceptual bloat to the core dist 23:07
dduncan fyi, one thing I got out of this exercise is that I think I will make exceptions when otherwise naming my basic data types after semantically-same Perl 6 types ... in this case, I will not name my character-only type 'Str', and instead call it 'Text' 23:16
so I won't have a Str type at all, and that should lessen confusion of users 23:17
nothingmuch probably 23:18
especially for a db related system
where text and blob are the conventions
dduncan yes
nothingmuch is omnigraffling 23:19
DEMOLIS HALL
23:21 sweinig is now known as sweinig|food
dduncan okay, so now darrenduncan.net/QDRDBMS/GSTV.pm uses 'Text' rather than 'Str' 23:27
nothingmuch btw, no need to 23:28
$v = '' . $v;
a. dual values are legal
b. there's no way to tell except with PvOK
dduncan okay, I'll remove those then
but the 0 + elsewhere is okay? 23:29
nothingmuch if you want to force numification that will actually do something, yes
but perhaps Scalar::Util::looks_like_number is better
dduncan I already use that
nothingmuch ah
then it's not really useful 23:30
if you just use it as a number, which you do later (in the int) then perl will cache the numified version IIRC
dduncan but I thought the 0+ would eliminate bounding whitespace and such, unless looks_like already fails stuff with spaces
nothingmuch it doesn't
and yes, that will take care of the spaces, etc
$v += 0; # more concise though
dduncan sure 23:31
okay, those changes are applied, thank you 23:32
fyi, the other reason to force numification is that so any subsequent use as a string will see a canonical string 23:35
eg, we don't get '0' or '0.0' etc
similarly, by Bool constructor canonicalizes the input 23:36
s/by/my/
subsequently, doing string equality tests on any of my 5 data types will always DWIM 23:37
if I was inclined to use the same operator for all types like it was a generic comparator 23:38
23:48 eggzeck joined