Re: object(x) rethink

new topic     » goto parent     » topic index » view thread      » older message » newer message

Bill Reed wrote:
 
> 
> object useless????
> 
> ----------------------------------------------------------------------
> A variable must be declared as an object in order to determine what
> type it is.
> 
>   object x
>   
>   if sequence(x) then
>     puts(1, "variable is a sequence")
>   end if
>   
>   if integer(x)
>     puts(1, "variable is an integer")
>   end if
>   
> ----------------------------------------------  
>   doeumentation for gets() from library.doc
> ----------------------------------------------
>   
> 
> Example 1:
> 
>               sequence buffer
>               object line
>               integer fn
>               
>               -- read a text file into a sequence
>               fn = open("myfile.txt", "r")
>               if fn = -1 then
>                   puts(1, "Couldn't open myfile.txt\n")
>                   abort(1)
>               end if
>               
>               buffer = {}
>               while 1 do
>                   line = gets(fn)
>                   if atom(line) then
>                       exit   -- -1 is returned at end of file
>                   end if
>                   buffer = append(buffer, line)
>               end while

Hi Bill,

Try please:
integer i   i= 1
atom a      a= 2
sequence s  s={3}
object x    x={4,{5}}

if object(i) then ? i end if
if object(a) then ? a end if
if object(s) then ? s end if
if object(x) then ? x end if


Is *object()*, not *object*, useful?

This *object()* is just a dummy function now.
It stands just for some 'symmetry' with integer(),
atom() and sequence() functions.

Do you see now?

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu