Conversation
Use CMake features that have been added since the files were first written. Accept CMake's defaults for file locations as far as possible
Some of the .io files have changed names One .c file is not to be compiled
This was because a function returning bool was being cast
to a function returning int. On Intel, MSVC returns a bool
only in the AL register, but returns an int in EAX, therefore
if the callee returned false (i.e. 0 in AL) the caller would
see 0 in the low byte and 'junk' in the high 3 bytes. If that
junk was non-zero, an if statement would take the true branch.
£include <stdbool.h>
£include <stdio.h>
bool test(int v) {
if (v >= 1000)
return true;
return false;
}
typedef int(testf)(int);
£define T(v) \
if (tt(v)) \
printf("%d >= 1000\n", v); \
else \
printf("%d < 1000\n", v)
int main(int argc, char *argv[]) {
testf *tt = (testf *)test;
T(500);
T(1000);
T(2000);
return 0;
}
Surprisingly prints
500 >= 1000
1000 >= 1000
2000 >= 1000
(note I replaced octothorpe with £ because of git)
Because the cache uses a PointerHash, it relies on identical string literals having the same address (i.e. constant merging). Unfortunately it seems they do not get merged in MSVC, at least on lower optimization levels.
Previously were returning IONIL but UArray is not an IoObject. (caused compile error in GCC)
|
Hey Peter, thanks for the cmake fixes/improvements. I should have mentioned when I shared my wasm links that the wasm branch removes the addons, libcoroutine, and cmake entirely. I'm concerned merging of this patch could make the merge of the wasm branch into main more difficult. What do you think? |
|
For sure, if cmake is going, there's no need to update that, and (this is where I don't know enough about wasm) any target-specific fixes also are obsolete - you just need to make it work for the WASM 'runtime'. Is that correct? |
|
Is the WASM branch imminent? If so, might as well hold off on this and see if there's anything useful left in it after WASM has been merged. |
|
Yeah, I think we just need it to work on WASM with a JS bridge if the focus is on web-native dev, with node as a server platform. Instantly, we'll have access to roughly 2 million pure JS NPM packages, plus a huge set of browser APIs for everything from WebGL, WebGPU, Geolocation, WebSockets, etc. |
|
I'm guessing ETA for wasm merge into main is a few weeks or less. |
|
Also planning to merge the Io web page repo into the Io source repo and redo the docs and add a bunch of web demos. |
|
Wow, busy time ahead! Just wondering, would an io-to-javascript transpiler do the same job? (like Coffeescript if you remember that) |
|
Unfortunately not AFAICS, as there are features like coroutines and futures which can't be translated to JS without building a language within it, which is a lot more than transpiling. |
|
I've been thinking about this and maybe it could retain proper (persistable) coroutines and still be (with a few tricks) performant despite being an interpreter implemented in JS . Maybe an IoScript would work! |
|
@pedro-w It builds on macOS ( Intel ) It passes most correctness tests but it run into some weirdness on SequenceTest.io I managed to trace it back to lines 394 and 395 on testToBase(). I guess the problem is somewhere in the implementation of assertRaisesException(), not really the test code. |
Description
(build dir)/toolsrather than(build dir)/_build/binariesI'm putting this as draft for now to get any comments. I am aware the forthcoming changes on the main branch will have a big impact on all this.
Type of Change
Testing