Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-sdd!apollo!lsmith From: lsmith@apollo.HP.COM (Lawrence C. Smith) Newsgroups: comp.lang.modula2 Subject: Re: Overloading Operators: Extension to Language Message-ID: <46075cda.1199f@apollo.HP.COM> Date: 4 Oct 89 16:43:00 GMT References: <"89-10-03-22:05:28.25*UI0T"@DKAUNI2.BITNET> Reply-To: lsmith@apollo.HP.COM (Lawrence C. Smith) Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 45 In article <"89-10-03-22:05:28.25*UI0T"@DKAUNI2.BITNET> Modula2 List writes: >Here comes another (more or less necessary) view... > >I think that overloading operators may be nice but not necessary. In my >opinion, there is a much simpler solution with pretty much the same >effect. > >How about an extension to the language which would allow functions to >return not only predefined types such as integers, reals and so on but >also records and arrays? What I'm thinking of could look like this: > >TYPE COMPLEX= RECORD RE,IM:REAL END; >PROCEDURE ADDC(A,B:COMPLEX):COMPLEX; ... Wirth forgot to restrict results to word-size types in the very first Modula-2 report (the one with the yellow ETH covers). The first compiler implemented to this spec that did not come from Wirth himself was Modula II for the p-System (on Apple II's and ///'s) from a company in California whose name escapes me now. They implemented record types for return values and then put in a switch to disable the feature when Wirth told them it was not supported. Their compiler was written in Pascal, and still lives as the Pecan Modula2 compiler for the p-System. Wirth has some very definite blind spots for language design that really puzzle me in a man so otherwise gifted. You'd think that returning records would be simple, obvious, and orthogonal and so would be one of his top hot buttons. Instead he seems to think they are anathema, and even today he just pays them lip service. Does Oberon allow them? Does it allow them but not implement them? Another of Wirth's blind spots is strings. To get real efficiency with strings you've just gotta have help from the compiler, but Wirth never, ever believed in them. Of course, if you add any of this you no longer have a sub-4000-line compiler. The man quests for small compilers the way Percival sought the Grail. -- Larry Smith Internet: lsmith@apollo.hp.com UUCP: {decvax,mit-eddie,umix}!apollo!lsmith