<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
This is not where Modula-3 falls down due to verbosity.<BR>
<BR>
<BR>
Many C and C++ programmers discourage such terseness:<BR>
int a, b, c(), d();<BR>
typedef int T1, T2;<BR>
<BR>
<BR>
preferring:<BR>
int a;<BR>
int b;<BR>
int c();<BR>
int d();<BR>
typedef int T1;<BR>
typedef int T2;<BR>
<BR>
<BR>
Where is falls down, perhaps, is not using curly braces.<BR>
(And perhaps for gyrations needed for safety, see my recent NTObjFile.m3 changes.<BR>
Can they be safe and not duplicate code, or only one?)<BR>
<BR>
<BR>
My editor is geared toward curly braces and helps using them tremendously.<BR>
I can't switch editors. I've tried many times.<BR>
<BR>
<BR>
I find the terseness Modula-3 does allow:<BR>
PROCEDURE(VAR a, b:INTEGER);<BR>
TYPE A = RECORD c, d: INTEGER:= 0; END.<BR>
<BR>
<BR>
ambiguous.<BR>
<BR>
I don't know if a and b are both VAR.<BR>
I don't know if c and d both have the initializer.<BR>
I'd prefer to see:<BR>
PROCEDURE(VAR a: INTEGER; VAR b:INTEGER);<BR>
TYPE A = RECORD c: INTEGER := 0; d: INTEGER:= 0; END.<BR>
<BR>
<BR>
(and I'm not sure that is equivalent, but I do know what it means.)<BR>
(newlines omited in RECORD just for *email brevity*: RECORD should have a newline per field!)<BR>
<BR>
I would be in favor of removing all these shorthands from the cm3 tree,<BR>
and maybe even warning about them. But they surely are all well defined<BR>
if you know the language well. It is meant to be a small language,<BR>
but goes a bit too far here I think.<BR>
<BR>
<BR>
- Jay<BR><BR> <BR>> Date: Tue, 2 Feb 2010 21:37:33 -0600<BR>> From: rodney_bates@lcwb.coop<BR>> To: m3devel@elegosoft.com<BR>> Subject: Re: [M3devel] Shorthand type declarations?<BR>> <BR>> <BR>> <BR>> Chris wrote:<BR>> > Alright, I'm finally getting the hang of things.<BR>> > <BR>> > One quick question..<BR>> > <BR>> > Is there a shorthand for declaring a whole bunch of types as one type? i.e....<BR>> > <BR>> > TYPE <BR>> > Window, Pixmap, Cursor = unsigned_int;<BR>> > <BR>> > Or something similiar?<BR>> > <BR>> > Doing this<BR>> > TYPE<BR>> > Window = unsigned_int;<BR>> > Pixmap = unsigned_int;<BR>> > Cursor = unsigned_int;<BR>> > etc...<BR>> > Adds up to whole lot of typing.(No pun intended)<BR>> <BR>> Unfortunately, this is the shortest you can get. I suppose the language designers<BR>> thought that, while a whole lot of variables with the same type were a likely<BR>> case:<BR>> <BR>> VAR x, y, z, u, v, w, h, i, j, h, ... : INTEGER; ,<BR>> <BR>> that more than just a few type names that are synonyms for the same type would not be common.<BR>> <BR>> You may think me certifiably masochist, but I go the more longhanded way and write:<BR>> <BR>> TYPE Window = unsigned_int;<BR>> TYPE Pixmap = unsigned_int;<BR>> TYPE Cursor = unsigned_int; ,<BR>> <BR>> sacrificing writeability in favor of readability. (Yes, I repeat VAR and CONST too,<BR>> almost every time.<BR>> <BR>> <BR>> > <BR>> > Any tips would be most welcome.<BR>> > <BR> </body>
</html>