Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: implement some runtime stuff in pure Jule #114

Merged
merged 52 commits into from
Sep 21, 2024
Merged

Conversation

mertcandav
Copy link
Member

@mertcandav mertcandav commented Sep 21, 2024

Important

The description of this PR is only for the main purpose that the PR is intended to do. It may contain some significant changes, additions and updates to achieve the main goal.

Alright. This PR may mean a milestone for Jule.

This PR basically: Moves part of the API to the standard library.

To explain in detail, implements some of the important things in pure Jule that Jule has at runtime and adds it to the standard library. Currently, the API was implemented in C++. In this PR some API functionality is implemented with Jule. Of course, this does not mean that the API has become narrower, in fact it now offers more functionalities.

There are some important reasons why the things required for the runtime should be implemented with Jule in this PR. Some of these are:

  • Although Jule currently only has a C++ backend, if the API is to be offered for the potential different backends it may have in the future (e.g. C), the entire API needs to be implemented in that language.
  • Depending on the backend, different implementation need to be done manually. Different algorithms must be written in different languages ​​for a single purpose for different APIs.
  • It encourages using Integrated Jule even for low-level Jule standard libraries.
  • Not friendly to contributors. For example, when a developer has an optimization idea in mind, if he knows Jule, he can implement it for the runtime implemented with Jule, but if he does not have much idea about the language implemented on the API side, this is a challenge. Additionally, in the case of multiple APIs, the same behavior must be implemented in the language in which each API is implemented. It's hard to maintain.
  • It is necessary to go synchronously with the API. Otherwise, it is difficult to realize that there is a conflict until the backend compiler causes problems.
  • Functions already implemented in the standard library must also be implemented again if required for the API. For example, for strings, a variant of the std::unicode::utf8 package must be implemented separately in the API.
  • Currently, the built-in map type is implemented by the C++ API with std::unordered_map, and this is clearly far from a standard implementation and it is a critical dependency to C++.
  • In operations such as I/O, string conversion is implemented by the API and backend language.

This PR solves some important problems listed above and brings additional benefits:

  • A significant part of the API is implemented in the standard library with pure Jule.
  • Jule runtime defines standardized and commonly usable functionalities.
  • Provides more runtime functionality for the API.
  • It eliminates repetitive implementations such as UTF-8.
  • Introduces standardized implementations. For example, the built-in map type is no longer implemented on the API side, but via Jule, and has a standard implementation defined for each potential backend.
  • String conversions are standardized and implemented with pure Jule, regardless of backend language. For string conversions, the compiler uses conversion algorithms provided by the Jule runtime behind the scenes.

In addition, since the runtime package will be imported by default for each Jule program, an increase in compilation times can be expected, but should not be a dramatic increase.

…ackage and fix deadcode optimization for exported defines
@mertcandav mertcandav added runtime Related with std/runtime or compiled behavior compiler Related with comptime or compilation problems api About API (C++ API, not std/runtime API implementation) labels Sep 21, 2024
@mertcandav mertcandav merged commit d07f697 into master Sep 21, 2024
42 checks passed
@mertcandav mertcandav deleted the move-api branch November 3, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api About API (C++ API, not std/runtime API implementation) compiler Related with comptime or compilation problems runtime Related with std/runtime or compiled behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant