Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion pmc_type
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nicholas Clark  
View profile  
 More options Oct 26 2004, 12:51 pm
Newsgroups: perl.perl6.internals
From: n...@ccl4.org (Nicholas Clark)
Date: Tue, 26 Oct 2004 17:51:29 +0100
Local: Tues, Oct 26 2004 12:51 pm
Subject: pmc_type
pmc_type is documented and implemented as follows:

/*

=item C<INTVAL
pmc_type(Parrot_Interp interp, STRING *name)>

Returns the PMC type for C<name>.

=cut

*/

INTVAL
pmc_type(Parrot_Interp interp, STRING *name)
{
    HashBucket *bucket;
    PMC *classname_hash = interp->class_hash;

    bucket = hash_get_bucket(interp, PMC_struct_val(classname_hash), name);
    if (bucket)
        return PMC_int_val((PMC*) bucket->value);
    return Parrot_get_datatype_enum(interp, name);

}

On IRC I asked:

17:44 <@Nicholas> can the type returned by Parrot_PMC_typenum for a PMC ever be
                  zero?
17:45 <@Dan> I don't think so, no
17:46 <@Dan> Take that back -- a PMC of type 'default' can have a type of 0
17:46 <@Dan> But you shouldn't ever have one, as they're not really
             instantiatable

In which case:

1: What does pmc_type return if it fails to find a PMC?
2: If that answer is 0, is it safe to document that 0 is a failure return,
   which happens to map to the PMC type for "default", but as they can't be
   instantiated looking up "default" is "not supported" (or words to that
   effect)

Nicholas Clark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google