GithubHelp home page GithubHelp logo

wu-lang / wu Goto Github PK

View Code? Open in Web Editor NEW
471.0 14.0 17.0 1.56 MB

๐Ÿ‰ A practical game and data language

Home Page: https://wu-lang.gitbook.io/guide/

License: MIT License

Rust 99.65% Lua 0.35%
programming-language language wu lua

wu's Issues

[improve] Steroids for the type system

Wu should have sum types as well as interface-like type parameters. This will speed up the development process, while also making it even more fun and nice to use the language:

Cat: struct {
  weight: float
}

Dog: struct {
  hat: bool
}

dog_or_cat: Cat | Dog = new Cat {
  weight: 1000
}

# can later be Dog

Then the following:

Vector3: struct {
  x: float, y: float, z: float
}

Vector2: struct {
  x: float, y: float
}

move2D: fun(thing: { x: float, y: float}, dx: float, dy: float) {
  thing x += dx
  thing y += dy
}

Consider updating the readme?

It hasn't been changed in over two years. To quote it:

Wu is built and maintained by a minimal team of people and was primarily developed during boring primary school classes, to help make time pass faster. Currently being maintained by an 18-year-old.

I think "currently being maintained by an 18-year-old" sounds very weird in a github repository. Are we meant to treat it as a request to not use it for anything serious? If we are, that's in contradiction with tongue-in-cheek You are using it on the selling points list just above it.
It's the kind of remark that could only hurt adoption of the project, imho. Not to mention that it's not even true anymore since time (sadly) doesn't stay constant. I'd suggest dropping that whole disclaimer altogether, the language works, it's irrelevant how it came to be ^^

[bug] implement parse failures

Several failures:

  • block is ignored if there is a keyword between two user types
Test: struct {}
implement Test if Test {}
  • parse fails if there's a newline in implement block body but no method
Test: struct {}
implement Test: Test {
}
  • implement accepts Type in place of Trait
Test: struct {}
implement Test: Test {
    foo: fun() {}
}
  • parse fails if there's extraneous newlines after method
implement Data: Data_T {
    clone:          extern fun(self) -> Data

}

[feature] Wildcard in imports

This is something we need to have. While it does have some downsides in introducing bad practice behavior, it's pretty useful.

Given lib.wu with the following content:

bob := "BUILDER"
important_number: float = 100.0

The following otherfile.wu ...

import lib { * }

Should automatically generate the following import code in otherfile.lua:

local lib = require('lib')
local bob = lib['bob']
local important_number = lib['important_number']

Cannot import file within the same folder, only from $WU_HOME

I don't know if it's they way it is intended to be, but I expected to be able to import a file from the same folder which the file I'm compiling resides in, but instead I got an error saying that there's no such module. But, if I set $WU_HOME to a directory somewhere and copy the file I'm importing to this folder, it compiles.
Is it intended to work this way, by only importing from $WU_HOME, or is it a bug? I'll copy here some of my terminal output

garcias@PHANTOM:~/src/wu-test$ ls
font  main.wu  wumodule.wu
garcias@PHANTOM:~/src/wu-test$ wu main.wu
Compiling main.wu

wrong: no such module `wumodule`, needed either `wumodule.wu`, `wumodule/init.wu` or in `$WU_HOME`
     --> main.wu
      โ”‚
    1 โ”‚ import wumodule { ten }
      โ”‚ ^^^^^^^^^^^^^^^^^^^^^^^
  Finished things in 0ms
garcias@PHANTOM:~/src/wu-test$

main.wu

import wumodule { ten }

wumodule.wu

ten := 10

Also, neither creating a directory called wumodule and putting a init.wu inside works, only inside $WU_HOME

[feature] visibility classifiers

Currently every symbol in a module is exported. Symbols should become private by default and export classifiers should be implemented, to be able to hide certain details.

Example:

bar: module {
    pub foo: fun() -> int { 42 }
        oof: fun() -> int { 24 }
}

a := bar foo() # 42
b := bar oof() # error: accessing private function <oof>
# bar.wu
pub foo: fun() -> int { 42 }
    oof: fun() -> int { 24 }

# main.wu
import bar { foo, oof } # error: importing private function <oof>

# main.wu 2
import bar

bar oof() # error: accessing private function <oof>

[bug] trait implementation failure

Trait implement does not seem to accept user types in signatures

Data: struct {}
Data_T: trait {
    clone: fun(self) -> Data
}
implement Data: Data_T {
    clone: extern fun(self) -> Data
}

error:

wrong: expected implemented type `fun() -> deid(Data)` for `clone`
     --> main.wu
      โ”‚
    5 โ”‚ implement Data: Data_T {
      โ”‚           ^^^^

Github sponsor issue

Hi,

I was trying to sponsor this very neat project but got prompted with an error

Screen Shot 2020-06-30 at 10 38 17 AM

I think the funding.yml is missing a few required fields:

github: [octocat, surftocat]
patreon: octocat
tidelift: npm/octo-package
custom: ["https://www.paypal.me/octocat", octocat.com]

funding-yml-file

iter() doesnt works/exists

As said in the title. iter() doesnt works.

conte := ["undertale", "underale"]
for x in iter(conte) {
    std print(conte)
}

Returns:

wrong: can't seem to find `iter`
     --> ./definitions.wu
      โ”‚
   32 โ”‚ for x in iter(conte) {
      โ”‚          ^^^^

[bug] trait parse failures

Trait body fails to parse if there's an additional newline or comment

Data_T: trait {

    getFFIPointer:  fun(self) -> any
}

error:

wrong: expected `Identifier`, found `EOL`
thread 'main' panicked at 'byte index 1 is out of bounds of ``', /home/evol/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/str/mod.rs:1920:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
     --> main.wu
Data_T: trait {
    getFFIPointer:  fun(self) -> any
    #asd

}

error:

wrong: expected `Identifier`, found `EOL`
thread 'main' panicked at 'byte index 9 is out of bounds of `    #asd`', /home/evol/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/str/mod.rs:1920:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
     --> main.wu

[improve] Even better error messages

While the current error messages are good, there is a lot of space for improvement. The error message system should be improved, either by hand or by plugging in something like Codespan.

The new errors should be helpful to the degree of Elm, and easily overviewed to the degree of Rust.

Let's get this.

[bug] import still doesn't behave predictably

When compiling imports should behave by this system:

compile file:       all imports are relative to initial file
compile directory:  all imports are relative to initial directory
build project:      all imports are relative to src/

The resulting require statements should also use . to separate path elements instead of / and should not contain a ./ prefix

project/
    src/
        lib/
            init.wu
            mylib.wu
        main.wu
    wu.toml

Contents:

# main.wu
import lib { mylib }

# init.wu
import mylib { MyType }

# mylib.wu
MyType: struct {}

Building project: ~/project$ wu build
Expected contents:

-- main.wu
local lib = require "lib"
local mylib = lib["mylib"]

-- init.wu
local mylib = require "lib.mylib"

-- mylib.wu
<empty>

Building directory: ~/project$ wu src/lib
Expected contents:

-- init.wu
local mylib = require "mylib"

-- mylib.wu
<empty>

Building file: ~/project$ wu src/lib/init.wu
Expected contents:

-- init.wu
local mylib = require "mylib"

-- mylib.wu
<empty>

[feature] Enums

Enums will be simple. My current idea is to have something like the following:

import enemies { Enemy }

Weapon: enum {
  Gun
  Swordfish
  Fist
}

damage_enemy_with: fun(enemy: Enemy, weapon: Weapon) {
  switch weapon {
    Weapon Gun => enemy damage(100)
    Weapon Swordfish => enemy damage(9000)
    Weapon Fist => enemy damage(10)
  }
}

Again; very simple. :)

Wu needs the non-stable channel of rust?

The intro documentation just mentions having rust and just running the cargo install. However, you need to be on the rust nightly/beta(?) branch I think. I get the following message on the stable release channel.

error[E0554]: #![feature] may not be used on the stable release channel
 --> src\lib.rs:1:1
  |
1 | #![feature(i128)]
  | ^^^^^^^^^^^^^^^^^

error[E0554]: #![feature] may not be used on the stable release channel
 --> src\lib.rs:2:1
  |
2 | #![feature(i128_type)]
  | ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Just figured I would let you know ;). Cool language btw!

Capitalization

Even though my english isn't that good, I still appreciate if beginning of sentences etc are capitalized. Makes everything a lot easier to read.

[visitor] False-positive implicit return in if-expressions

The visitor is marking expressions at the end of if-expressions as implicit returns, even if it isn't the real last expression of the root block.

import lover { grahics }

foo: fun -> int {
  if false {
    # returns here
    graphics setColor(1, 1, 0)
  }

  if true {
    # properly inserts return here too
    200
  }
}

[bug] symbol imports are not exported like module imports

Attempting to use Object from love results in an error

# love/types.wu
Object: struct {}

# love/init.wu
import types { Object }

# main.wu
import love

asd : fun() -> love Object {
    new love Object {}
}

error:

wrong: no such module member `Object`
     --> main.wu
      โ”‚
    3 โ”‚ asd : fun() -> love Object {
      โ”‚                     ^^^^^^

REPL for wu

Just like lua has its own REPL(read-eval-print-loop), as in example below:

bash% lua
Lua 5.4.2 Copyright (C) 1994-2020 Lua.org, PUC-Rio

print("hi")
hi

function f1(x)

print("hi")
end

f1()
hi


In the same way please implement REPL for wu

how to escape quotes in a string?

i have some code, that looks like this:

print("something \"something\" something else")

but when i compile i get this error:

Compiling init.wu

wrong: bumped into weird character
     --> ./init.wu
      โ”‚
    1 โ”‚ print("something \"something\" something else")
      โ”‚                             ^
  Finished things in 0ms

how can i fix the code?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.