#114WIP: IX Language Design Overview

  • avatar~jeff-hykincommented · 2 years ago
    Author

    Slightly different from the language manual, I think it'd be good to have a place that summarizes your (@paperdave) design decsions, for stuff like no-null.

    I'll try to keep this always-up-to-date (and it'll remain WIP nearly forever)

    Overview

    Key design goals:

    • Static types with good Type inference
    • Comptime like zig
    • Compile to JavaScript
    • Inter-compaible with JS
    • Incremental compilation
    • Hot module reloading
    • Explicit external/side effects (@extern)

    Design decisions:

    • If statements are expressions (not statements)
    • No dynamic weblang imports
    • No weblang-eval, only js eval(** confirmation needed)
    • Imported code cannot have side effects (no top level runtime code)
    • exports are explicit (the pub keyword) unlike python or C exports
    • No pointers, only references (** clarification needed IMO)
    • Null doesn't exist as a value (** clarification needed IMO)
    • There will be a standard format and formatter
    • Has a return keyword (behaves like normal)
    • Recursive types will be allowed (ex: in structs)

    Syntax decisions:

    • @ is special. Effectively a namespace for compiler-built-ins; @import, @extern, @"identifier"
    • {} are for code
    • .{} are for struct instantiation
    • [] are for arrays

    Other features:

    • Zig like multiline strings
    • Full lambda functions (not python lambdas)
    • Tuples

    Unconfirmed desires:

    • http imports
    • no main function necessary in the entrypoint file
    • per-import permissions
    • perefer or heavily default to immutable

    Milestone: 0.2.0.

  • avatar~jeff-hykin changed the status to Todo · 2 years ago
  • avatar~lino-levancommented · 2 years ago

    @ is for compiler built ins. .{} is for structs. I don't think we have "objects" yet in the JS sense (we probably need a map type cc @paperdave).

    No dynamic weblang imports

    yep.

    No weblang-eval, only js eval

    yep.

    No https imports

    not if I get my say, though it looks like dave is on-board with http imports

  • avatar~jeff-hykincommented · 2 years ago
    Author

    not if I get my say

    Why???? Http imports are the only reason deno is even usable

  • avatar~lino-levancommented · 2 years ago

    Sorry I think the double negative was confusing here, I am pro-http import and I think dave is too.

  • avatar~lino-levancommented · 2 years ago

    Null doesn't exist as a value (** clarification needed IMO)

    None might compile down to null but I think it's all fair game for optimization.

  • avatar~jeff-hykincommented · 2 years ago
    Author

    Oh okay. Well I made an issue for http imports anyways and moved it to the "desired" section

  • avatar~clovercommented · 2 years ago
    Owner

    this document is essential, as i have already told many people that im driving all language design using objective reasoning; there is a reason for everything. however, documentation for that reasoning is missing, and it wouldn't belong in the manual i think. i think docs/design.md would be good

  • avatar~jeff-hykincommented · 2 years ago
    Author

    Another major thing: does WL have an export keyword?

  • avatar~lino-levancommented · 2 years ago

    WL's export is pub which is rust + zig use iirc.

  • avatar~clovercommented · 2 years ago
    Owner

    I'll try to keep this always-up-to-date (and it'll remain WIP nearly forever)

    i didn't see this line initially, this issue will be closed when design.md and language-manual.md document the entire issue. thank you for including an overview