Git Product home page Git Product logo

bobascript's Introduction

howdy! ๐Ÿ‘‹

Pronouns Twitch Status Twitter Follow

my name's Justin! I'm a 24-year-old software engineer, and this is where I put all the miscellaneous things I work on in my free time.

if you wanna get a grasp of some of the things I'm currently working on, check my pinned repositories!

links:

bobascript's People

Contributors

sand-head avatar

Stargazers

 avatar  avatar

Watchers

 avatar

bobascript's Issues

Type system

I want a type system like TypeScript's that makes me feel all-powerful and godlike in defining the structure of my objects. is that so much to ask?

initial concept:

type Option<T> = enum {
  Some(T),
  None,
};

type DataWrapper<T> = #{
  "data": T
};

type TwitchUser = #{
  "id": String,
  "login": String,
  "display_name": String,
  "type": String,
  "broadcaster_type": String,
  "description": String,
  "profile_image_url": String,
  "offline_image_url": String,
  "view_count": Number,
  "email": String,
  "created_at": String,
};

fn get_user(id: Number): Option<DataWrapper<TwitchUser>> {
  let user = // get the user from the Twitch API somehow...
  user
};

// `user` is inferred to be of type `Option<DataWrapper<TwitchUser>>`
let user = get_user(141981764);
if let Some(user) = user {
  log("we got a user!");
} else {
  log("we probably have to refresh our key...");
};

Block expressions in binary operations are wonky and cause errors

the following code throws a type error at runtime:

let test = "1" + {
  let test2 = 15;
  test2 / 3
};

this is the debug result:

== code ==
0000 #0001 Constant 0001 "1"
0001 #0002 Constant 0002 15 
0002 #0003 GetLocal(0)      
0003 #0003 Constant 0003 3  
0004 #0003 Divide
0005 #0004 Pop
0006 #0004 Add
0007 #0004 DefineGlobal(0)
0008 #0004 Return

0001 #0001 Constant 0001 "1"
        ["1"]
0002 #0002 Constant 0002 15
        ["1"][15]
0003 #0003 GetLocal(0)
        ["1"][15]["1"]
0004 #0003 Constant 0003 3
        ["1"][15]["1"][3]
0005 #0003 Divide
[!] Runtime error: Type error: expected value of type "number", found "1".

resolving locals doesn't work when there are other values in the stack, as it recognizes 15 as the value of the first local and assumes it to be at stack index 0, when it isn't. this is probably covered in the book during the function chapter but I haven't read it yet

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.