🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #3485

Re: gadgets in 2.0

#3485
From: Martin Taillefer
Date: Mon, 07 May 1990 03:43
43 lines
2705 bytes
In article <24783@pasteur.Berkeley.EDU> navas@cory.Berkeley.EDU.UUCP (David C. Navas) writes:
>In article <1990May6.183020.17956@calgary.uucp> pepers@enme3.UUCP (Brad Pepers) writes:
>[Speaking about varargs function calls]
>>There is no
>>way to declare a routine like that for Pascal, Modula2, etc... They just
>>don't allow variable parameter lengths. So these wonderful new functions
>>can't be used by anything but C and assem!!!
>
>Wrongo...  Well actually, righto, but there are workarounds.. :)

Yes, the new gadtools library accepts tag arguments, as do many of the new
system routines. The varargs magic though is in the C front-end and
has in reality nothing to do with the way the system actually works.

What I mean is that the system actually DOES expect only a POINTER to an
array of TAG items. The C compiler converts the varargs parameters into such an
array and then passes the address of the array to the ROM code.

Tags are very flexible and extensible, which is why they are being used. 
It is clear however that this scheme was not meant for languages with decent
type checking. And since I know the guy(s) that thought up tags does not like
type-checked languages, it's no surprise.

From a language such as Modula-2, it is annoying to do tags. Using the
current compilers, you'd need to declare an array of tags and fill them in
before calling the routine. This is very inconvenient. Using array
constructors as described in the forthcming ISO M2 standrad allows these
arrays to be declared inline, in the function call, which effectively
gives you varargs.

The only remaining problem is with type checking. The main reason I chose
M2 was for type checking, the fact that the compiler will catch my mistakes
for me, instead of having the GURU find them. There's also a tremendous
documentation value in fully typed system structures. I don't really
see a solution to this problem, it IS very annoying.

In any case, I think it will be very annoying to do tags with the current
M2 compilers. We're working on something to address this I hope :-)

-- 
----------------------------------------
Martin Taillefer   INTERNET: martin@pnt.CAM.ORG
UUCP: uunet!philmtl!altitude!martint   TEL: 514/640-5734   BIX: vertex
Technical Details
Message-ID: <1990May7.034352.439@altitude.CAM.ORG>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!philmtl!altitude!martint
References: <1990May6.183020.17956@calgary.uucp> <24783@pasteur.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!philmtl!altitude!martint
From: martint@altitude.CAM.ORG (Martin Taillefer)
Newsgroups: comp.sys.amiga.tech
Subject: Re: gadgets in 2.0
Keywords: gadgets 2.0
Message-ID: <1990May7.034352.439@altitude.CAM.ORG>
Date: 7 May 90 03:43:52 GMT
References: <1990May6.183020.17956@calgary.uucp> <24783@pasteur.Berkeley.EDU>
Organization: None
Lines: 43