Skip to content

0.7.5 [Beta testing]

Pre-release
Pre-release

Choose a tag to compare

@brCreate brCreate released this 10 Jul 07:19
· 25 commits to main since this release

This is a striking change to the Plant programming language. Not until we introduced the std keyword have we only had builtin (functions, etc.). This is sad because it wastes a lot of usable space for global variables. And it is not friendly to the C++ programmers who are our intended users. To ensure familiarity as well as faster builtin calls, we introduced the std keyword, with striving to provide the arrangement and nomenclature same as those of C++ as possible. For example, here's what you might write before 0.7.5:

print toString(abs(-3));

Here's what you will write:

print std::any::toString(std::abs(-3));

Though it's somehow a little bit more verbose, it does enhance clarity and provides faster navigation to those builtin functions (because internally, we use GET_GLOBAL codes with hash tables inside the VM, but now we ported them out, away from the VM; as well as a new code STD has been designed).

This also ensures that we could add almost unlimited builtin functions (and classes, might be in the future). Before, we use global variables to store them. This is a hilarious waste of memory, and we cannot store more beyond PL_GET_GLOBAL_LONG (though we're sure that nobody will ever do so, but, who knows, just in case...); and storing too much builtin things will interfere the normal accesses to the user-declared global variables also. So, it's a good idea to store them separately.

Speaking of adding builtin functions, here's some useful headers (Plant jargon; borrowed from the C++ header that you need to include before you use std) that we may add in the future releases:

  • vector
  • map
  • string
  • math
  • algorithm (Handles things like sorting, arranging, etc.)
  • regex (Handles regular expression)
  • random (Handles the generation of random numbers, etc.)
  • chrono (Handles time & time zone, probably)
  • filesystem (Handles files and directory; similar to Python's os.path sub-module)

(You could guess the meaning already if you are an intermediate C++ developer or more professional)

By the way, there's one header that does not exist in C++: plant. plant is a header specifically designed for the runtime instance property management, type checking (e.g. isinstance, etc.) owing to the fact that Plant is built on a dynamically typed land. It is roughly equivalent to Python's sys module (SALUTE! to pydevs after each allusion!), but rather not identical.

Ubuntu on GNU/Linux is also supported now. You could differentiate the two UNIX-compliant executables by looking at there suffixes: ./plant-darwin is for macOS, and plant is for GNU/Linux.