Thread View: comp.lang.oberon
2 messages
2 total messages
Started by Mike Griebling
Thu, 11 Apr 1996 10:26
Re: Why no Complex Arithmetic ?
Author: Mike Griebling
Date: Thu, 11 Apr 1996 10:26
Date: Thu, 11 Apr 1996 10:26
27 lines
1310 bytes
1310 bytes
> What is missing in Oberon-2 is something like type-bound operators, > implemented similar to type-bound procedures. > > E.g.: > > PROCEDURE( COMPLEX ) "+" > ( VAR RVal1 : COMPLEX; > VAR RVal2 : COMPLEX > ) : COMPLEX; > BEGIN > .... > END "+"; > > Juergen Neuhoff Even if Oberon-2 had type-bound infix operators, you still would not be able to return structured types from a function so any types would have to be implemented as pointers. While not especially difficult it would make the garbage collector work much harder tracking all the freed variables which could have been stack-based instead of heap-based. Regards, Michael -------------------------------------------------------------- Michael Griebling, P. Eng. grieblm@inforamp.net Computer Inspirations grieblm@trt.allied.com
Re: Why no Complex Arithmetic ?
Author: M Hamburg
Date: Tue, 16 Apr 1996 08:11
Date: Tue, 16 Apr 1996 08:11
24 lines
1557 bytes
1557 bytes
B. Smith-Mannschott argues that type-bound operators violate Oberon's fully qualified import. Type-bound procedures have already done that. Now, whether that is a good thing or not, is a different matter but the deed is already done. (Personally, I'm increasinly inclined to feel that it is not a good thing.) As for complication in the compiler, I've actually done it in a compiler for an Oberon like language and the burden isn't all that high. So, the question really is, how important is fully qualified import? If you think it's important, then Oberon-2's type-bound procedures have the wrong syntax. If you don't, then simple operator overloading is fairly straightforward. It's quite useful for things like complex numbers and simple geometric types. (It is also subject to horrendous abuses, but so are a lot of programming constructs.) I put it into the language I was working on because it seemed like a clear extension of type-bound procedures. Now that I'm looking at recasting their syntax, it looks like operator overloading will have to go away as well. Mark
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads