Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Autogenerated attribute accessor names
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
Stevan Little  
View profile  
 More options Jul 5 2005, 5:26 pm
Newsgroups: perl.perl6.language
From: ste...@mail.iinteractive.com (Stevan Little)
Date: Tue, 5 Jul 2005 17:26:31 -0400
Local: Tues, Jul 5 2005 5:26 pm
Subject: Autogenerated attribute accessor names
Hello,

As I am building the metamodel, I had a question, I did not find anything specifically in
the docs regarding this.

What should I do when I encounter two attributes which can peacefully co-exist as
attributes, but cause a class when we autogenerate the accessors for them. Here is a
quick example:

class Foo {
        has @.bar;
        has $.bar;

}

Should $.bar win out because it is defined last? Or would @.bar win because it would
create the accessor first, then when an attempt to create the accessor for $.bar is made,
it will see an entry for bar() already in the class, and so not generate one (as that is the
default behavior when a user-created bar() is made)?

Should we enforce something along the lines of method conflict in roles? So that any
conflicts for autogenerated accessor methods will result in neither of them being
generated and therefore force the user to disambiguate manually?

On some level this might be able to be handled with MMD, and call context detection,
but I think that might actually make things far more confusing than they actually need
to be, but that is just MHO. Especially since it would create difficulties when something
like this is encountered.

class Foo {
        has @.bar;
        has $.bar;

        # the autogenerated mutli method accessors
        # multi method bar(Array @value) returns Array;
        # multi method bar(Scalar $value) returns Scalar;

        method bar () {...}

}

Unless of course we use Yuval's "everything is a MMD under the hood" idea. But that is
another thread entirely.

Thanks,

Stevan


    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.
Larry Wall  
View profile  
 More options Jul 5 2005, 9:08 pm
Newsgroups: perl.perl6.language
From: la...@wall.org (Larry Wall)
Date: Tue, 5 Jul 2005 18:08:32 -0700
Local: Tues, Jul 5 2005 9:08 pm
Subject: Re: Autogenerated attribute accessor names
On Tue, Jul 05, 2005 at 05:26:31PM -0400, Stevan Little wrote:

: What should I do when I encounter two attributes which can peacefully co-exist as
: attributes, but cause a class when we autogenerate the accessors for them. Here is a
: quick example:
:
: class Foo {
:       has @.bar;
:       has $.bar;
: }

Probably for now we should do the conservative thing and carp as
soon as we notice it, much like for role method conflicts.  We could
relax that later if we find a decent way to disambiguate, but I don't
think there will be great demand for it.  In any event, as with role
conflicts, if they write their own method, it overrides both of them
anyway and they can figure it out them own selves.  If we pretend
attribute declarations are anonymous role declarations, they might
turn out to be just that, especially if we decide it's a useful conceit.

Larry


    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.
Stevan Little  
View profile  
 More options Jul 5 2005, 9:56 pm
Newsgroups: perl.perl6.language
From: ste...@iinteractive.com (Stevan Little)
Date: Tue, 5 Jul 2005 21:56:41 -0400
Local: Tues, Jul 5 2005 9:56 pm
Subject: Re: Autogenerated attribute accessor names
Larry,

On Jul 5, 2005, at 9:08 PM, Larry Wall wrote:

> If we pretend attribute declarations are anonymous role declarations,
> they might
> turn out to be just that, especially if we decide it's a useful
> conceit.

This exact thing occurred to me as I was sitting in traffic on the way
back from $work. I think it probably makes the most sense to do it this
way. We can always change it later if it proves to be too restrictive.

Steve


    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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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