oak icon indicating copy to clipboard operation
oak copied to clipboard

primitives and spec missing on website

Open iacore opened this issue 10 months ago • 13 comments

Hello @thesephist

I can't find the primitives like input() on oaklang.org/.

I also have some other questions

  • is there read and write from lisp
  • how to use Oak inside an application as scripting language

iacore avatar Aug 27 '23 09:08 iacore

You can use Oak inside of another language easily if you and the language have Shell access and can keep doing so. Just install Oak, and then use 'oak' to enter the repl.

SpcFORK avatar Sep 08 '23 03:09 SpcFORK

I can't find the primitives like input() on oaklang.org/.

You could probably find some clues in the 'env.go' file starting at oakinput on line 577.

SpcFORK avatar Sep 08 '23 04:09 SpcFORK

I end up finding the built-in functions in docs/spec.md

iacore avatar Mar 13 '24 12:03 iacore

This is true, but there are a few variables that aren't listed there inside the env

image

As you can see, these variables are usable within the latest Oak. They just aren't in the old spec.md.

SpcFORK avatar Mar 13 '24 18:03 SpcFORK

lib -> import gc -> collect garbage mem -> show memory usage lib__oak_qm -> ?

iacore avatar Mar 13 '24 19:03 iacore

lib__oak_qm -> ?

lib__oak_qm -> import exists in memory?

SpcFORK avatar Mar 13 '24 19:03 SpcFORK

lib__oak_qm -> import exists in memory?

i can't find it in the source code

iacore avatar Mar 13 '24 19:03 iacore

lib__oak_qm -> import exists in memory?

i can't find it in the source code

Well, you can use it to get a true or false if a lib has been imported, e.g. ___runtime_lib?('std')

SpcFORK avatar Mar 13 '24 20:03 SpcFORK

I also found ___runtime_proc(), which returns the current pid and oak excutable name.

	c.LoadFunc("___runtime_lib", c.rtLib)
	c.LoadFunc("___runtime_lib?", c.rtIsLib)
	c.LoadFunc("___runtime_gc", c.rtGC)
	c.LoadFunc("___runtime_mem", c.rtMem)
	c.LoadFunc("___runtime_proc", c.rtProc)

Oak is a good language. Will the author ever come back to update the official website?

iacore avatar Mar 14 '24 14:03 iacore

Not sure, but I've been using it with Kaboom for my games.

It's pretty good when you build to the web since you can interop between JS and Oak almost seamlessly.

SpcFORK avatar Mar 14 '24 17:03 SpcFORK

It's pretty good when you build to the web since you can interop between JS and Oak almost seamlessly.

How do I do that interop? Do I print the object to string and send it?

iacore avatar Mar 15 '24 00:03 iacore

It's pretty good when you build to the web since you can interop between JS and Oak almost seamlessly.

How do I do that interop? Do I print the object to string and send it?

No, you have to be building with --web

SpcFORK avatar Mar 15 '24 00:03 SpcFORK

I misunderstood. I thought you were mentioning interop between Oak code in browser and Oak code on server.

I want to add basic features such as chdir to Oak. Can I submit the patch to your fork?

iacore avatar Mar 15 '24 11:03 iacore