Skip to content

Commit

Permalink
update to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Sep 30, 2024
1 parent 053b451 commit b0a2671
Show file tree
Hide file tree
Showing 77 changed files with 477 additions and 711 deletions.
102 changes: 51 additions & 51 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -445,102 +445,102 @@ export default defineConfig({
link: '/std/',
items: [
{ text: 'builtin', link: '/std/builtin' },
{ text: 'std::bytes', link: '/std/bytes' },
{ text: 'std::comptime', link: '/std/comptime' },
{ text: 'std::conv', link: '/std/conv' },
{ text: 'std::debug', link: '/std/debug' },
{ text: 'std/bytes', link: '/std/bytes' },
{ text: 'std/comptime', link: '/std/comptime' },
{ text: 'std/conv', link: '/std/conv' },
{ text: 'std/debug', link: '/std/debug' },
{
text: 'std::encoding',
text: 'std/encoding',
link: '/std/encoding',
items: [
{ text: 'std::encoding::ascii85', link: '/std/encoding-ascii85' },
{ text: 'std::encoding::base32', link: '/std/encoding-base32' },
{ text: 'std::encoding::base64', link: '/std/encoding-base64' },
{ text: 'std::encoding::binary', link: '/std/encoding-binary' },
{ text: 'std::encoding::csv', link: '/std/encoding-csv' },
{ text: 'std::encoding::json', link: '/std/encoding-json' },
{ text: 'std/encoding/ascii85', link: '/std/encoding-ascii85' },
{ text: 'std/encoding/base32', link: '/std/encoding-base32' },
{ text: 'std/encoding/base64', link: '/std/encoding-base64' },
{ text: 'std/encoding/binary', link: '/std/encoding-binary' },
{ text: 'std/encoding/csv', link: '/std/encoding-csv' },
{ text: 'std/encoding/json', link: '/std/encoding-json' },
],
},
{ text: 'std::env', link: '/std/env' },
{ text: 'std::flag', link: '/std/flag' },
{ text: 'std::fmt', link: '/std/fmt' },
{ text: 'std/env', link: '/std/env' },
{ text: 'std/flag', link: '/std/flag' },
{ text: 'std/fmt', link: '/std/fmt' },
{
text: 'std::fs',
text: 'std/fs',
link: '/std/fs',
items: [
{ text: 'std::fs::path', link: '/std/fs-path' },
{ text: 'std/fs/path', link: '/std/fs-path' },
],
},
{
text: 'std::hash',
text: 'std/hash',
link: '/std/hash',
items: [
{ text: 'std::hash::adler32', link: '/std/hash-adler32' },
{ text: 'std::hash::fnv', link: '/std/hash-fnv' },
{ text: 'std/hash/adler32', link: '/std/hash-adler32' },
{ text: 'std/hash/fnv', link: '/std/hash-fnv' },
],
},
{ text: 'std::io', link: '/std/io' },
{ text: 'std/io', link: '/std/io' },
{
text: 'std::jule',
text: 'std/jule',
link: '/std/jule',
items: [
{ text: 'std::jule::ast', link: '/std/jule-ast' },
{ text: 'std::jule::build', link: '/std/jule-build' },
{ text: 'std/jule/ast', link: '/std/jule-ast' },
{ text: 'std/jule/build', link: '/std/jule-build' },
{
text: 'std::jule::constant',
text: 'std/jule/constant',
link: '/std/jule-constant',
items: [
{ text: 'std::jule::constant::lit', link: '/std/jule-constant-lit' }
]
},
{ text: 'std::jule::importer', link: '/std/jule-importer' },
{ text: 'std::jule::integrated', link: '/std/jule-integrated' },
{ text: 'std::jule::lex', link: '/std/jule-lex' },
{ text: 'std::jule::parser', link: '/std/jule-parser' },
{ text: 'std::jule::sema', link: '/std/jule-sema' },
{ text: 'std::jule::types', link: '/std/jule-types' },
{ text: 'std/jule/importer', link: '/std/jule-importer' },
{ text: 'std/jule/integrated', link: '/std/jule-integrated' },
{ text: 'std/jule/parser', link: '/std/jule-parser' },
{ text: 'std/jule/sema', link: '/std/jule-sema' },
{ text: 'std/jule/token', link: '/std/jule-token' },
{ text: 'std/jule/types', link: '/std/jule-types' },
]
},
{ text: 'std::maps', link: '/std/maps' },
{ text: 'std/maps', link: '/std/maps' },
{
text: 'std::math',
text: 'std/math',
link: '/std/math',
items: [
{ text: 'std::math::big', link: '/std/math-big' },
{ text: 'std::math::bits', link: '/std/math-bits' },
{ text: 'std::math::cmplx', link: '/std/math-cmplx' },
{ text: 'std::math::rand', link: '/std/math-rand' },
{ text: 'std/math/big', link: '/std/math-big' },
{ text: 'std/math/bits', link: '/std/math-bits' },
{ text: 'std/math/cmplx', link: '/std/math-cmplx' },
{ text: 'std/math/rand', link: '/std/math-rand' },
],
},
{
text: 'std::mem',
text: 'std/mem',
link: '/std/mem',
items: [],
},
{ text: 'std::net', link: '/std/net' },
{ text: 'std::process', link: '/std/process' },
{ text: 'std::runtime', link: '/runtime/' },
{ text: 'std::slices', link: '/std/slices' },
{ text: 'std::strings', link: '/std/strings' },
{ text: 'std/net', link: '/std/net' },
{ text: 'std/process', link: '/std/process' },
{ text: 'std/runtime', link: '/runtime/' },
{ text: 'std/slices', link: '/std/slices' },
{ text: 'std/strings', link: '/std/strings' },
{
text: 'std::sync',
text: 'std/sync',
link: '/std/sync',
items: [
{ text: 'std::sync::atomic', link: '/std/sync-atomic' }
{ text: 'std/sync/atomic', link: '/std/sync-atomic' }
],
},
{ text: 'std::sys', link: '/std/sys' },
{ text: 'std::testing', link: '/std/testing', },
{ text: 'std::time', link: '/std/time', },
{ text: 'std/sys', link: '/std/sys' },
{ text: 'std/testing', link: '/std/testing', },
{ text: 'std/time', link: '/std/time', },
{
text: 'std::unicode',
text: 'std/unicode',
link: '/std/unicode',
items: [
{ text: 'std::unicode::utf16', link: '/std/unicode-utf16' },
{ text: 'std::unicode::utf8', link: '/std/unicode-utf8' },
{ text: 'std/unicode/utf16', link: '/std/unicode-utf16' },
{ text: 'std/unicode/utf8', link: '/std/unicode-utf8' },
],
},
{ text: 'std::unsafe', link: '/std/unsafe' },
{ text: 'std/unsafe', link: '/std/unsafe' },
],
},
],
Expand Down
4 changes: 2 additions & 2 deletions src/common-concepts/structures/reserved-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The `Str` reserved method implements a special string conversion algorithm, repl

### Example
```jule
use conv for std::conv
use "std/conv"
struct Num {
x: int
Expand All @@ -53,7 +53,7 @@ struct SNum {
impl SNum {
fn Str(self): str {
ret conv::itoa(self.x)
ret conv::Itoa(self.x)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/backend/cpp-backend-compilers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MSVC is supported by Jule. Our GitHub Action workflows use MSVC Clang on Windows

### Jule 0.0.13 and Before

Jule does not support MSVC. This is why you won't have an official MSVC support. We ran into issues when we tried IR's support of MSVC experimentally. Our standard libraries such as `std::sys` contain code that is not compatible with MSVC. We had a problem when we tried to compile JuleC IR with MSVC Clang. So even if you want to do that, you're probably going to have to put effort into MSVC.
Jule does not support MSVC. This is why you won't have an official MSVC support. We ran into issues when we tried IR's support of MSVC experimentally. Our standard libraries such as `std/sys` contain code that is not compatible with MSVC. We had a problem when we tried to compile JuleC IR with MSVC Clang. So even if you want to do that, you're probably going to have to put effort into MSVC.

## C++ Standards

Expand Down
4 changes: 2 additions & 2 deletions src/comptime/comptime-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ List of supported primitive types: `str`, `bool`, `f32`, `f64`, `i8`, `i16`, `i3
- Compiler casts basic constant expressions like `int` to `uint` casting.
- The built-in `len` function returns constant length data for constant strings, arrays and other comptime supported types.
- Compiler converts constant-string to byte-slice, constant-string to rune-slice, constant-rune to string, constant-byte to string castings.
- Calls strict comptime functions that provided by the [`std::comptime`](/std/comptime) package.
- Calls strict comptime functions that provided by the [`std/comptime`](/std/comptime) package.
- Executes comptime algorithms such as comptime matching or comptime iterations.

### Untyped Literals
Expand Down Expand Up @@ -73,7 +73,7 @@ They can also be used to store primitive types as well as supported types provid

For example:
```jule
use comptime for std::comptime
use "std/comptime"
const MagicNumber = 20
Expand Down
4 changes: 2 additions & 2 deletions src/comptime/comptime-iterations.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Iteration variables are useable and they will be constant. You can use relevant

A comptime iteration is defined like a typical range-based iteration. However, in addition, the `const` keyword must be included at the beginning of the definition. This declares that the iteration will be executed comptime. You cannot able to use `continue` or `break` keywords for compile-time iterations.

The types provided by the [`std::comptime`](/std/comptime) package that can be used in iterations are explained in the package documentation.
The types provided by the [`std/comptime`](/std/comptime) package that can be used in iterations are explained in the package documentation.

Example to comptime iterations:
```jule
use comptime for std::comptime
use "std/comptime"
struct MyStruct {
Foo: int
Expand Down
2 changes: 1 addition & 1 deletion src/comptime/comptime-matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If the `comptimeTypeInfo` (it usually returned by the `comptime::TypeOf` functio

For example:
```jule
use comptime for std::comptime
use "std/comptime"
fn printType[T]() {
const match type comptime::TypeOf(T) {
Expand Down
4 changes: 2 additions & 2 deletions src/comptime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Comptime is short for compile-time. Means all of compile-time actions.

Jule provides compile-time functionalites empowered by language design and the standard [`std::comptime`](/std/comptime) library that provides a beefed-up experience for compile-time. This library provides functionalities that can be used for various purposes. It is designed for compile-time only, it does not add anything for runtime execution.
Jule provides compile-time functionalites empowered by language design and the standard [`std/comptime`](/std/comptime) library that provides a beefed-up experience for compile-time. This library provides functionalities that can be used for various purposes. It is designed for compile-time only, it does not add anything for runtime execution.

Comptime statements do not have runtime equivalents because they are designed specifically for compile-time. Therefore any comptime statement that should result in runtime execution will cause a compile error.

Besides the [`std::comptime`](/std/comptime) package provided to empowering the comptime, Jule has the `const` keyword. This keyword stands for `constant` and represents constant computations that can be handled at comptime, and it is important part of the comptime.
Besides the [`std/comptime`](/std/comptime) package provided to empowering the comptime, Jule has the `const` keyword. This keyword stands for `constant` and represents constant computations that can be handled at comptime, and it is important part of the comptime.
22 changes: 11 additions & 11 deletions src/comptime/reflection.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Jule does not store any metadata about the program at runtime. Therefore, it is

Compile-time reflection may not be as comprehensive as runtime reflection in some cases, but it is still useful and functional for many purposes. Also, it is less costly and more performant than runtime reflection.

To access comptime reflection functions with Jule, the [`std::comptime`](/std/comptime) library must be used. This library is provided by Jule by default and provides some functionality to be used at compile time.
To access comptime reflection functions with Jule, the [`std/comptime`](/std/comptime) library must be used. This library is provided by Jule by default and provides some functionality to be used at compile time.

Some things you can do with compile-time reflection:
- Examine the structures, process identifiers and types
Expand All @@ -17,12 +17,12 @@ Some things you can do with compile-time reflection:

## Introduction to Reflection for Types

To start examine any type, use `comptime::TypeOf` function. This function provided by the [`std::comptime`](/std/comptime) library and it's essential for type examination.
To start examine any type, use `comptime::TypeOf` function. This function provided by the [`std/comptime`](/std/comptime) library and it's essential for type examination.

For example:

```jule
use comptime for std::comptime
use "std/comptime"
fn FooBar[T](x: T) {
const t = comptime::TypeOf(T)
Expand All @@ -36,12 +36,12 @@ The type information wrapper provides only functionalities for the type. Not dec

## Introduction to Reflection for Values

To start examine any value, use `comptime:ValueOf` function. This function provided by the [`std::comptime`](/std/comptime) library and it's essential for value examination.
To start examine any value, use `comptime:ValueOf` function. This function provided by the [`std/comptime`](/std/comptime) library and it's essential for value examination.

For example:

```jule
use comptime for std::comptime
use "std/comptime"
fn FooBar[T](x: T) {
const v = comptime::ValueOf(x)
Expand All @@ -62,7 +62,7 @@ This unwrap functionality provides additional benifits for value reflection such
For example:

```jule
use comptime for std::comptime
use "std/comptime"
fn PrintFields[T](s: T) {
const t = comptime::TypeOf(T)
Expand All @@ -88,7 +88,7 @@ Function implementation checks whether type `T` is struct and then prints values
<summary>Print Field Names of Struct</summary>

```jule
use comptime for std::comptime
use "std/comptime"
struct FooBarBaz {
Foo: str
Expand All @@ -110,7 +110,7 @@ fn main() {
<summary>Print Field Types of Struct</summary>

```jule
use comptime for std::comptime
use "std/comptime"
struct FooBarBaz {
Foo: str
Expand All @@ -132,7 +132,7 @@ fn main() {
<summary>Basic Generic Type Examination</summary>

```jule
use comptime for std::comptime
use "std/comptime"
cpp type Int: int
Expand Down Expand Up @@ -180,7 +180,7 @@ fn main() {
<summary>Fill Arrays with Responsive Size</summary>

```jule
use comptime for std::comptime
use "std/comptime"
fn Fill[Arr, Elem](mut &arr: Arr, mut elem: Elem) {
const t = comptime::TypeOf(Arr)
Expand Down Expand Up @@ -211,7 +211,7 @@ fn main() {
<summary>Print All Public Fields of Struct Instance</summary>

```jule
use comptime for std::comptime
use "std/comptime"
struct FooBarBaz {
Foo: int
Expand Down
8 changes: 4 additions & 4 deletions src/concurrency/atomicity.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ The above code creates threads that increment the global `n` variable by 1. As a

Atomic accesses can be used to synchronize memory accesses. An atomic process locks the corresponding memory space so that it can only be accessed by one thread at a time. This causes the increment and read operations to be performed safely. Because threads wait for the relevant memory area to be unlocked, and only one of them can take over this lock and perform operations at a time.

Jule provides the `std::sync::atomic` package for atomicity as standard. Now let's take a look at the above code secured with `WaitGroup` and atomic operations:
Jule provides the `std/sync/atomic` package for atomicity as standard. Now let's take a look at the above code secured with `WaitGroup` and atomic operations:

```jule
use sync for std::sync
use atomic for std::sync::atomic
use "std/sync"
use "std/sync/atomic"
static mut n = atomic::AtomicInt.New(0)
static mut n = atomic::Int.New(0)
fn addToN(mut wg: &sync::WaitGroup) {
defer { wg.Done() }
Expand Down
4 changes: 2 additions & 2 deletions src/concurrency/mutexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In the previous section, atomics were explained and when atomicity was required

For example:
```jule
use sync for std::sync
use "std/sync"
static mut n = 0
Expand Down Expand Up @@ -36,7 +36,7 @@ To solve this problem we can use a mutex. Mutexes are locking mechanisms that al
For example:

```jule
use sync for std::sync
use "std/sync"
static mut n = 0
static mtx = sync::Mutex{} // [!code ++]
Expand Down
4 changes: 2 additions & 2 deletions src/concurrency/wait-groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ fn main() {

In the code above there is a concurrent call to a function that writes `Hello World` on the command line. It is possible that you will not see the result when you execute this code. This is probably because your program terminates before your concurrent call has finished executing, as described above. Your program may terminate before your call can print `Hello World` to command line.

Jule provides the `WaitGroup` struct in the `std::sync` standard library so that you can wait for your threads and trace their execution. The `WaitGroup` structure acts as a kind of counter for threads. It is simple to use. You basically use it for three tasks: increasing the counter for new threads, decreasing the counter for completed threads, and waiting for the counter to go down to zero, that is, for all threads to finish executing.
Jule provides the `WaitGroup` struct in the `std/sync` standard library so that you can wait for your threads and trace their execution. The `WaitGroup` structure acts as a kind of counter for threads. It is simple to use. You basically use it for three tasks: increasing the counter for new threads, decreasing the counter for completed threads, and waiting for the counter to go down to zero, that is, for all threads to finish executing.

For example:

```jule
use sync for std::sync
use "std/sync"
fn sayHello(mut wg: &sync::WaitGroup) {
outln("Hello World")
Expand Down
Loading

0 comments on commit b0a2671

Please sign in to comment.