SCOUG-Programming Mailing List Archives
Return to [ 05 | 
August | 
2003 ]
 >> Next Message >>
 
 
 
Content Type:   text/plain 
> Lynn H. Maxson wrote:  
> > Suppose that you had a variable-length, character variable  
> > which not only had an upper limit but whose use dictates a  
> > lower one as well.  You currently have no means in an HLL  
> > to express this rule.  Thus you, the programmer, has to  
> > enforce the rule (assuming, one, that you know it, and,  
> > two, that you remember it wherever) in every instance of  
> > its use.  
> >   
> > You cannot, for example, declare it as part of the data  
> > definition, which allows you only to specify an upper  
> > limit:  
> >     dcl jimmy char (17) varying;  
> > Now how much of a jump to rocket science is it to be able  
> > to change this to  
> >     dcl jimmy char (5:17) varying;  
> > Suppose if it is text, that it contains caps only:  
> >     dcl jimmy char (5:17) varying range ((A...Z)...);  
>   
> This is a much better example.  I believe that Pascal has the capability  
> of defining a variable as a member of a set (for example the only legal  
> values are the characters "A, "X" and "Z" or the values (not strings!)  
> Dog and Cat) but I've never used that capability of the language so  
> can't comment on its robustness.  
>   
> The ability to define a minimum length is enticing.  In PL/I (at least  
> in the now-antiquated PL/I Level F compiler) every variable had an  
> associated control block which contained the declaration for the  
> variable (including the address of the actual data).  When you called a  
> subroutine the address of the control block rather than the address of  
> the data was passed to the subroutine; the subroutine in turn could  
> determine what form the data existed in and could act accordingly.  You  
> could, for example and if the language were extensible, add a BCD value  
> to a text string containing Roman numerals.  This was typically  
> accomplished with a single subroutine containing multiple entry points,  
> one entry point for each possible combination of parameter declarations  
> plus a general-purpose entry point that would convert the parameters to  
> a common declaration.  
>   
> So it's been done.  In assembler.  :)))  
 
I will lead off by saying:  I don't grok object-oriented programming.  
BUT...  Isn't the assembler example that Peter pulled out of the guts  
of the PL/I compiler really just an example of object-oriented programming?  
One that is implemented by the compiler designer behind the scenes?  
An "Object" accessed through the control block in assembly?  
 
In spite of Lynn's praises of PL/I, we are now presented with a short  
comming of the language.  We can only specify an upper limit on the  
length of a character variable:  
     dcl jimmy char (17) varying;  
If we want a lower limit as well, THEN JUST CHANGE THE LANGUAGE:  
     dcl jimmy char (5:17) varying;  
 
I thought the whole point of object-oriented programming was to allow  
the programmer to define a class, lets call it CHAR, that would have  
the properties of minimum AND maximum length character variables.  
 
But, I am still trying to absorb the Object Oriented aspects of  
Python.  And it is still a big undigested lump slowly moving down  
the snake....  
 
Anyway, take this for what it is worth from someone who does NOT   
yet grok this whole Object-Oriented approach.  
--   
Gregory W. Smith (WD9GAY)                            gsmith@well.com  
 
=====================================================  
 
To unsubscribe from this list, send an email message  
to "steward@scoug.com". In the body of the message,  
put the command "unsubscribe scoug-programming".  
 
For problems, contact the list owner at  
"rollin@scoug.com".  
 
=====================================================  
 
  
 >> Next Message >>
Return to [ 05 | 
August | 
2003 ] 
  
  
The Southern California OS/2 User Group
 P.O. Box 26904
 Santa Ana, CA  92799-6904, USA
Copyright 2001 the Southern California OS/2 User Group.  ALL RIGHTS 
RESERVED. 
 
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International 
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
 
 |