Skip to content

Commit

Permalink
std/comptime: refactor documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jan 19, 2025
1 parent 278c065 commit a7d56dd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion std/comptime/analysis.jule
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Emplaces a type alias declaration to statement which is this function called.
// Defines a type alias with ident which is alias for t.
// The parameter t can take type declarations or comptimeTypeInfo only.
// fn TypeAlias(ident, t)
// fn TypeAlias(ident: str, t: T)

// Returns line number of statement which is this function called.
// Returns as constant expression.
Expand Down
17 changes: 9 additions & 8 deletions std/comptime/decl.jule
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ struct comptimeDecls {}

// Private compile-time declaration information wrapper.
// Designed for general declarations, not for instantiated/analyzed types.
// List of supported types;
// - variables
// - functions (with parameters)
// - traits (with methods)
// - enums (with fields)
// - type enums
// - structs (with fields and methods)
// - type aliases
//
// List of supported types:
// - variables
// - functions (with parameters)
// - traits (with methods)
// - enums (with fields)
// - type enums
// - structs (with fields and methods)
// - type aliases
struct comptimeDecl {}

impl comptimeDecl {
Expand Down
24 changes: 12 additions & 12 deletions std/comptime/type.jule
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ enum Kind {
// comptime type information handling is useful.
// For example:
//
// type ByteSlice: []byte
// const t = comptime::TypeOf(ByteSlice)
// const match type t.Kind() {
// | comptime::Kind.Slice:
// const match type t.Elem().Kind() {
// | comptime::Kind.Byte:
// ...
// }
// }
// type ByteSlice: []byte
// const t = comptime::TypeOf(ByteSlice)
// const match type t.Kind() {
// | comptime::Kind.Slice:
// const match type t.Elem().Kind() {
// | comptime::Kind.Byte:
// ...
// }
// }
//
// In the example code above, the ByteSlice type is a strict type alias.
// But we can examine the actual type with comptime type information api.
// fn TypeOf(TYPE || EXPRESSION): comptimeTypeInfo
// In the example code above, the ByteSlice type is a strict type alias.
// But we can examine the actual type with comptime type information api.
// fn TypeOf(t: T): comptimeTypeInfo

/* >>> Hint comptimeTypeInfos implementation.

Expand Down
2 changes: 1 addition & 1 deletion std/comptime/value.jule
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Cannot assign to memory, just available in compile-time.
// The expression is evaluated to determine and handle value in compile-time and
// will not executed at runtime.
// fn ValueOf(EXPRESSION): comptimeValue
// fn ValueOf(v: V): comptimeValue

/* >>> Hint comptimeValue implementation.

Expand Down

0 comments on commit a7d56dd

Please sign in to comment.