Comments (3)
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.
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.
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)
- Slow reading big text files HOT 11
- parameter doesn't match (SYSTEM.ADDRESS) HOT 2
- SET is 64-bit in Component Pascal size model HOT 3
- x11 examples HOT 1
- runtime should kill when assigning to an unallocated pointer (was: returning pointer to a local variable) HOT 21
- uninitialized variable usage warning
- stabs debug format is not supported at least on one aarch64 platform. HOT 2
- Create Directory HOT 7
- pointer to record broken
- warning: implicit declaration of function
- Wrong Position when error occured HOT 2
- update gcc string to consider MODULES environment variable
- MOD issue HOT 21
- Improved C language interface HOT 11
- passing VAR s: POINTER TO ARRAY OF CHAR passes compilation but later doesn't compile in C HOT 2
- libvoc-02.so not found after make full HOT 1
- Files.WriteSet wrong type in SYSTEM.VAL HOT 3
- Make does not properly uninstall: typo in variable name HOT 1
- Error in WITH statement with pointers to related type extended records HOT 7
- Documentation of voc internals HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from voc.