>>>>> "BM" == Brandon McCaig <bamcc...@gmail.com> writes:

  BM> my $obj = Foo::Bar->new;

  BM> ...instead. It seems better to just avoid the name "new" entirely so
  BM> it isn't confused with other languages. I think it will be less
  BM> confusing for people that way. I know that I found it confusing to see
  BM> the C++-like syntax, only to have people on this list discourage it
  BM> and say that it doesn't do what we think it does. I'm not fixed on
  BM> 'create', but generally I name my "constructor" functions in C
  BM> "${struct_name}_create" (where $struct_name is the name of the
  BM> struct), so it just seems logical that I would name my constructors in
  BM> Perl 'create' as well (after all, that's essentially what they're
  BM> doing).

perl isn't strict about many things but the perl community does have
many conventions. one of which is using the sub new for object
constructors. you will not get far in the perl world if you buck the
tide of things like that. any other good ideas you may have will be
tainted by this one. use new() and drop the create() stuff. also there
is a perl builtin called creat() (a wrapper to the unix syscall). so
your name has even more confusion potential.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to