invocable all
or:
invocable Rectangle, Line
and then you won't need the bogus block.
Majorinc, Kazimir wrote:
Icon allows powerful explicitly defined polymorphism. Here is an example.
############################ record Rectangle(x1,x2,y1,y2) record Line(x1,x2,y1,y2) procedure size_of_Rectangle(r) return (r.x2-r.x1)*(r.y2-r.y1) end procedure size_of_Line(l) return sqrt((l.x2-l.x1)^2+(l.y2-l.y1)^2) end procedure size_of(anything) s:="size_of_"||type(anything) g:=proc(s) return g(anything) bogus { size_of_Line() size_of_Rectangle() } end end procedure main() write("size of Rectangle and Line (1,2,3,4) is respectively") write(size_of(Rectangle(1,2,3,4)),", ",size_of(Line(1,2,3,4))) end ############################
Implementation is however, uncomfortable: it works fine with bogus block, but if bogus block is commented out, program doesn't work, because smart Icon linker doesn't link procedures it cannot connect with main().
Is there any option to set that linker optimization off?
----
Kazimir Majorinc, Zagreb, Croatia
------------------------------------------------------------------------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19. 8. 2003.
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Unicon-group mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/unicon-group
