🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #4161

Re: M2 IO

#4161
From: 00704a-Liber
Date: Fri, 15 Apr 1988 23:24
40 lines
2528 bytes
In article <8804140925.AA13150@klaus.olsen.uucp> Info-Modula2 Distribution List <INFO-M2%UCF1VM.bitnet@jade.berkeley.edu> writes:
>C++ IO interests me.  I find the syntax:
>        printf( cout, "error message %s %s %d\n", string1, string2, rc );

>more readable than:
>        cout << "error message " << string1 << " " << string2 << " " << rc;

Yes, but when you use printf() you have to declare the type of each
variable in the format string.  If you use C++ streams the compiler does
this for you.  I know of no other way to do something like this with a
variable number of arguments.

>Operator overloading is far too limited.  A truly flexible language
>might allow encoding "write" as follows:
>        cout write "error message " string1 " " string2 " " rc
>
>Does C++ allow infix procedures other than the standard set?

No.  Doing this tends to lead to unreadable code.  For example:  If I
overload the word 'or' as an infix operator, this sentence no longer has
the same meaning that I intended (this is because 'word' becomes 'w or d'.
Did you find the other 'word' in that sentence which contains 'or' yet?).
It also leads to nightmares for the parser (is '/+' an error or an overload
operator, etc.).

>Note the advantage of M2 generics over C++ is that you not only get
>the pointer, but you have the option of pass-by-value or pass-by-reference.
>Another important feature is that M2 generics pass the size of the type
>which can used in a limited form of dynamic type checking.

Learn about the language before you criticize it!!!  C++ has both
call-by-reference and call-by-value (the former being new with respect to C
and the latter being the same as passing an address in C), as well as a way
to have automatic dynamic type checking (if you want the additional runtime
overhead that's required).
-- 
 _ __			NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194
' )  )				"The secret compartment of my ring I fill
 /  / _ , __o  ____		 with an Underdog super-energy pill."
/  (_</_\/ <__/ / <_	These are solely MY opinions, not AT&T's, blah blah blah
Technical Details
Message-ID: <4444@ihlpf.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!ihnp4!ihlpf!nevin1
References: <8804140925.AA13150@klaus.olsen.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!ihnp4!ihlpf!nevin1
From: nevin1@ihlpf.ATT.COM (00704a-Liber)
Newsgroups: comp.lang.modula2,comp.lang.c++
Subject: Re: M2 IO
Message-ID: <4444@ihlpf.ATT.COM>
Date: 15 Apr 88 23:24:40 GMT
References: <8804140925.AA13150@klaus.olsen.uucp>
Reply-To: nevin1@ihlpf.UUCP (00704a-Liber,N.J.)
Organization: AT&T Bell Laboratories - Naperville, Illinois
Lines: 40