Giter Club home page Giter Club logo

Comments (3)

norayr avatar norayr commented on September 14, 2024

hey, thank you for the comment. yes, I believe github is more convenient for discussion than wordpress comment system.

as you said, Oberon has no vararg functions.
however, it's quite possible to link to vararg C functions, and I believe, I have done it several times.

the only thing you need, is to create a different Oberon function for each vararg C variant you want to call. For example, imagine there is a C function
int add_em_up (int count,...)

then we would create several Oberon wrappers:

``IMPORT SYSTEM; (* this is necessary for modules that link to C code *)
PROCEDURE -AddEm(a, b: INTEGER): INTEGER
"add_em_up(a, b)";

PROCEDURE -AddEm1(a, b, c: INTEGER): INTEGER
"add_em_up(a, b, c)";

PROCEDURE -AddEm2(a, b, c, d: INTEGER): INTEGER
"add_em_up(a, b, c, d)";``

Is that enough for you, or do you need varargs in Oberon language?

from voc.

z505 avatar z505 commented on September 14, 2024

Hi, how about the calling conventions... STDCALL vs CDECL vs PASCAL call?
How does oberon link up to different declarations, STDCALL and such.

I would ideally enjoy an oberon language with VARARG ability, similar to GoLang, and also a STRING type like in Eberon. Rather than always using ARRAY OF CHAR, a string similar to GoLang and Eberon (extended oberon).
https://github.com/vladfolts/oberonjs/wiki/Eberon-Strings

However that is a separate comment :-)

Do you ever find the need for VarArgs like pascal's old convenient WriteLn that was more generic and not so fixed?

I understand Wirth's objection to features as they can cause abuse, however in GoLang these have proven extremely useful.

from voc.

norayr avatar norayr commented on September 14, 2024

Hey, hey. (:

How does oberon link up to different declarations, STDCALL and such.
I believe the same way.

You've probably noticed thath voc generates C code. And that PROCEDURE -Something syntax is a very simple and universal way to define wrappers.

Once I've managed (as I remember) to duscuss that with Gutknecht and Wirth. We decided to not introduce pragmas for the different calling conventions for the port of O-7 compiler I was writing.

I also agree, that it's better to make it as a compile time flag (that would imply that all function wrappers in a given module use that calling convention), or use same PROCEDURE -Something syntax.

As you may notice in the source files, like Unix.Mod, this syntax is not necessarily used in order to define wrappers, but also let's say to include some header.

also a STRING type like in Eberon

On strings, they can be implemented in libraries. I was thinking about the strings a lot, and came to the conclusion that it complicates the language and leads to ambiguities. I believe that it's better to keep strings out of the language.

I personally use unicode (utf-8) strings with voc a lot, by having only one byte character type.

I dislike the syntax which uses '+' for string concatenation, because, though it's fast to write, but then, which is the '-' operator for strings? What's '/' then? And if we would like to write faster, there are many scripting languages that created by keeping that in mind.

So, in short, code procedures (when name is prefixed with '-' sign) are used to create wrappers, and calling convention does not matter, I believe.

Anyway, Oberon has to gather a community, and different compilers have to compete for features, users. So I am glad there is an interest, independently from my personal opinion. I can hope that voc can turn out to be useful as is now, but we are trying to move it forward to some directions, and a lot of work have been already done.

from voc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.