Consider the following script:

#!/usr/bin/ksh93t

print "KSH Version: ${.sh.version}"

typeset -T Pt_t=(
   float -h 'length in inches' x=1
   float -h 'width in inches' y=0

   # if next line is uncommented causes core dump when r1 is instantiated
   # integer -S count=0

   len()
   {
      print -r $((sqrt(_.x*_.x + _.y*_.y)))
   }
)

typeset -T Rect_t=(
    Pt_t ll=(x=0 y=0)
    Pt_t ur=(x=2 y=2)

    area()
    {
       print -r $((abs((_.ur.x-_.ll.x)*(_.ur.y-_.ll.y))))
    }
)

# create an instance of r1
Rect_t r1

print "R1 AREA: ${r1.area}"

exit


I get a core dump if I uncomment the "integer -S count=0" line.

#0  0x0048ae2a in bestalloc ()
#1  0x0048b25d in bestresize ()
#2  0x0045f65b in _ast_calloc ()
#3  0x004298fc in nv_clone_disc ()
#4  0x00429e1c in clone_all_disc ()
#5  0x00445f5d in fixnode ()
#6  0x00446183 in clone_type ()
#7  0x00429e10 in clone_all_disc ()
#8  0x00429efe in nv_clone ()
#9  0x00448641 in nv_settype ()
#10 0x00444981 in b_common ()
#11 0x00444237 in b_typeset ()
#12 0x004060a8 in sh_exec ()
#13 0x00402f3c in exfile ()
#14 0x0040263d in sh_main ()
#15 0x00401ae2 in main ()

Is the use of a shared variable, i.e. count, unsupported in this type 
of definition?  

- Finnbarr

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to