Ticket #745 (closed bug: wontfix)

Opened 13 years ago

Last modified 13 years ago

Make `newclass <STR>` and `newclass <PMC>` consistent

Reported by: Austin_Hastings Owned by:
Priority: minor Milestone:
Component: none Version: 1.2.0
Severity: low Keywords: newclass,pmc,class
Cc: Language:
Patch status: Platform: linux

Description

(I have marked this "bug" because a reading of the code suggests the behaviors are already in agreement. But see the attached file to show otherwise.)

Creating a class via newclass <STR>

$P0 = newclass 'Dog'

does not add methods from the namespace. While creating the same class via newclass <PMC>

.local pmc class_info
class_info = new 'Hash'

class_info['name'] = 'Dog'
$P0 = newclass class_info

will cause the namespace to be scanned for methods (if the PMC passes a series of validations).

In fact, the documentation for newclass states that it accepts an optional PMC with init info: newclass <STR>, <PMC>, but this is unsupported in the ops. I believe the current behavior is acceptable, but the <STR> and <PMC> versions should behave the same w.r.t. harvesting methods from the namespace. (Alternatively, if there is to be a variant that does not scan for methods, it should be the <PMC> version under the control of a configuration setting in the PMC.)

Attachments

try.pir Download (1.3 KB) - added by Austin_Hastings 13 years ago.
Shows inconsistent behavior between newclass <STR> and <PMC>

Change History

Changed 13 years ago by Austin_Hastings

Shows inconsistent behavior between newclass <STR> and <PMC>

Changed 13 years ago by Austin_Hastings

The cause here was a misunderstanding on my part of acceptable name formats. The "Foo;Bar;Dog" used when dumping names is not valid for creating new ones. (?!)

Converting to [ 'Foo' ; 'Bar' ; 'Dog' ] produces a Class-Already-Registered error, and converting 'Dog' to 'Cat' (with a duplicated namespace) produces correct behavior.

Closed.

Thanks to Jonathan, NotFound on #parrot.

Changed 13 years ago by Infinoid

  • status changed from new to closed
  • resolution set to wontfix
Note: See TracTickets for help on using tickets.