Perl6 Object Oriented Cookbook (v0.2.1)  
Section 7: Subclassing Built-in Types  
 
Recipe 7.1: Scalar Subclasses
Last Updated: Sep 8, 2003
Status: Draft
      Previous Page   Next Page

How important is this problem to you?
  (Login to Vote)
5.00 Rating, 2 Votes  

How acceptable is the proposed solution?
  (Login to Vote)
5.00 Rating, 1 Vote  

Problem:  

You want to create an object that can be accessed like a normal scalar variable.

Solution:  

Inherit from the builtin type scalar:

class MyClass is scalar { ... }

Discussion:

(Need to document interface of scalar)


Log In to Comment


Login / Edit User Info -- Copyright © 2002 Cognitivity -- Previous Page   Next Page