[Oberon] Variadic functions or procedures, VARARG ...
Jörg Straube
joerg.straube at iaeth.ch
Wed Jan 27 13:39:56 CET 2016
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
More information about the Oberon
mailing list