Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!hp4nl!htsa!fransvo From: fransvo@htsa.uucp (Frans van Otten) Newsgroups: comp.lang.modula2 Subject: Re: Are procedure types breaking modules? Keywords: procedure types, modules Message-ID: <849@htsa.uucp> Date: 24 Apr 89 10:39:38 GMT References: <688@tuvie> Reply-To: fransvo@htsa.UUCP (Frans van Otten) Organization: AHA-TMF (Technical Institute), Amsterdam, The Netherlands Lines: 44 Ulrich Neumerkel writes: >When considering 6.8 of the Modula-2 report only procedures local to >other procedures and standard procedures are forbidden to be assigned >to a variable of a procedure type. This means that it is possible >to call a procedure which is not exported from another module, when >you pass the procedure dynamically. I do not believe that this >feature is really undesirable, however was it really intended? It probably was not intended. I think Wirth thinks of a lot of nice features for a programming language, but doesn't consider all consequences before publishing. The fact that he manages to write a lot of contradictionary things (even within one book) supports this. Also, he is not clear on why some things are or are not allowed. Why is it that you are not allowed to assign a local procedure to a procedure variable ? Why can't a standard procedure be assigned to a procedure variable ? >The problem that might arise here is that there might be >introduced invisible dependencies. The alternative would be a complicated >dataflow analysis or even a runtime check. > >o Is this a desirable feature, have you used it in "real" programs? >o Are there any alternatives to it? You could call a procedure which is exported from another module. When calling it you give a parameter indicating which (unexported) function should be called. Then, using a case statement or an array of which the component is of the procedure type, you have (almost) the same result. >Just to cite Wirth (3rd ed. p84) [...checking no absoulte safeguard...] >>After all, it [module concept] concerns formal, syntactic aspects only; it >>does not cover the semantics. Don't use single quotes of Wirth ! That is highly dangerous ! Read all of what he writes, then try to figure out what he might have meant using your imagination and logics ! -- Frans van Otten Don't blame me, I'm Algemene Hogeschool Amsterdam just another Modula 2 Technische en Maritieme Faculteit compiler writer ! fransvo@htsa.uucp