Aaron Sherman wrote:
True, but they are not math functions. They are Num <--> Str conversions, and I haven't figured out where to put those yet.On Thu, 2005-03-17 at 20:47 -0500, Aaron Sherman wrote:
Methods on numeric values (should be defined as pseudo-methods on unboxed numbers):
chr
hex
oct
Sigh... well, now I know what Ctrl-Return does in Evolution :-/
Ok, so what I was getting at was that the above three are methods on numbers.
C<length> will be gone once I get there. It's there as a placeholder to remind me to write the replacements. (Reminds me to write array versions of them as well).You might also provide a procedural alias, but:
multi sub lenth(: Str ?$string = $CALLER::_) returns Int {
$string.size; # I think it was called that
}
Proposals for replacement/reform should go to the list. But until the matter is changed there, I'm sticking with the Perl5 usage. Yea, it's a pain in the rump, but it can be invaluable in certain scenarios.These are real procedurals:
pack
Hopefully we'll have something more flexible and user-extensible...
Do read the S09 sections "Compact Structs" and "Compact Arrays" first, however.
A/S05 talks about it some. It's a Str property/method, mainly used with rule matches. I think it's going to return an String::Position object which can translate between bytes/chars/codepoints/graphemes
pos
Grrr.. I can't recall what Larry had said about this... I know he
mentioned it once on this list. Maybe that was the ruleish "pos"?
sprintf
Ah blessed sprintf. Were we adopting a Pythonish implicit sprintf? I
forget. Would that impact the existence of explicit sprintf? Probably
not.
It got renamed C<as> recently, and will be pervasive, and in many forms.
The function side of it is easy. S06 says "The |caller| function returns an object that describes a particular "higher" dynamic scope, from which the current scope was called."caller
Larry has said this is a rather hairy TBD in the past, though it might
have been discussed since.
It's defining that object that gets a little interesting...
defined
A universal (pseudo-)method?
Fairly universal, yes.
C<prototype> I will apply to code refs. I'll have to think more about it later.prototype
ref
C<ref> will be like C<defined>, but might get renamed to something like C<.meta.class>
C<die> is staying, and only getting revamped to take into account the P6 exception scheme.die
do
C<do block> is not a function, but is in S04.
C<do subroutine> is dead.
C<do filename> I'll tackle at the same time as C<eval>. It's likely staying in some form. I use it from time to time when I'm patching together several automation scripts. (Remember that Perl gets used for the quick and dirty as well as the big and elegant.)
undef
How will undef($x) and $x=undef compare in p6? Has that been covered? I
have a vague memory, but nothing swimming to the surface.
I think they're the same, but I really don't know.
If nothing else, I plan on making a form that works on Int as well as one that works on Str. I don't know how many times I've had to resort to masks and shifts to do something vec should have done for me nicely.vec
This is pack with issues :)