[Oberon] Variadic functions or procedures, VARARG ...

John R. Strohm strohm at airmail.net
Thu Jan 28 05:25:37 CET 2016


Actually, type checking is one of the important concepts of modern programming languages, PERIOD.

The whole point of variadic procedures is to allow varying-length parameter lists, with varying parameter types.  It was originally invented to allow printf() adn their ilk in C.

Variadic procedures break type checking, by definition.

(Yes, this does mean that C, and C++ because of the backwards-compatibility requirement observed by Stroustrup, are inherently broken, by design.)

There are REASONS why the designers of Ada chose not to do that.  (And there are reason why Bell Labs declined to submit a C-based candidate language to the DOD1 evaluation, that eventually yielded Ada.)

--- joerg.straube at iaeth.ch wrote:

From: Jörg Straube <joerg.straube at iaeth.ch>
To: ETH Oberon and related systems <oberon at lists.inf.ethz.ch>
Subject: Re: [Oberon] Variadic functions or procedures, VARARG ...
Date: Wed, 27 Jan 2016 13:39:56 +0100

Lars

One of the important concepts of Oberon is type checking be it during compile time or during runtime in case of inheritance.
So the problem with variadic is rather the missing types of the arguments than the nbr of arguments.
If all arguments have the same type (eg INTEGER) you can use open arrays in Oberon

PROCEDURE Variadic (arglist: ARRAY OF INTEGER)

Jörg

> Am 27.01.2016 um 03:03 schrieb Douglas G. Danforth <danforth at greenwoodfarm.com>:
> 
> Lars,
> I would side step the issue and replace the needed compiler functionality
> with a run time solution where the variable number of arguments is replaced with
> a pointer to a list (of arguments).  Very simple.
> -Doug Danforth
> 
> 
>> On 1/26/2016 5:33 PM, Lars wrote:
>> Hi, I can't find any information on Variadic functions for oberon or how
>> one would interface to a C function that is variadic. Does oberon use any
>> trick to support this, or it forbids you from using variadic or
>> interfacing with variadic?
>> 
>> Just to recap what variadic means, it's a function like this:
>> 
>> PROCEDURE Something(param1: INTEGER; otherparams...)
>> 
>> The ... means multiple parameters. In freepascal I believe this is known
>> as VARARGS whereas C and golang call it variadic function.
>> 
>> I'm guessing this is forbidden because oberon prefers everything to be
>> fixed and known up front, and variadic functions go against the psychic
>> programmer philosophy of huge design up front and knowning everything
>> about everything. i.e. define the exact amount of parameters up front, or
>> go home and you aren't welcome here... or something like that.
>> 
>> But how would oberon interact with a C library with variadic function
>> accepting multiple parameters?
>> 
>> Varidiac functions have been proven to be extremely useful in Golang
>> although they are one of those double edged swords that is extremely
>> useful, until someone uses it for abuse. So I am guessing oberon outright
>> forbids it...
>> 
>> Any information would be helpful. Would also be nice to hear Wirth's
>> comments on it in one of his books or articles since he refuses to
>> communicate with Human DNA and only communicates with Wine and Cheese
>> eating non spinach alien DNA's. (this is a serious question about variadic
>> function support in oberon, but the email most definitely contains some
>> humor worth every nickle)
>> --
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon




More information about the Oberon mailing list