content
# Waifu Language Brainstorming\n\nLegend:\n    - 🧠: brainfart idea\n\nAuthors:\n    - zergling-man (zerg for short)\n    - pepega (pepe for short)\n\n# Discussion(s)\n\n\n\n# Notes\n\n### :pencil: What base types will the language support\n    \n- p: I think this is most import thing to talk about rn (see [Keywords](#Keywords))\n    - Because we should know what we're working with\n    - Also which kinds/typeclasses (also need to figure out actual name for this)\n    - \n\n### :pencil: What are symbols? How are they different from keywords?\n\n- z: Symbols are keywords\n\n### :pencil: How to return\n\n- z: a symbol (keyword). Although assigning to a specific var sounds fun, short-circuiting is important, if people want to just do assignment they can do that themselves.\n\n### Rename language to wai\n\n- pepega: 🧠\n    - `wai` sounds asian and cool. We know where it came from, but others don't have to\n    - `fu` can be some tool/construct or a compiler. `wai` uses `fu`\n- zerg: 🧠\n    - Keep language called waifu but call commands waic/waip. Just to mess with people.\n\n### Do you agree merging if and ternary operators into a single ? (if) : (else) operator :? (elseif)\n\n? x > 5\n   'x is more than 5' \n:? x > 4\n   'x is more than 4'\n:\n   z\n\nnote: A little ocd but i don't like the fact that else if would have 2 characters while if and else have 1 \n\n\n# Agreements\n\n### So we agreed that:\n\n- [Compiler][Language] Type annotations are optional. Compiler should figure out the best types when calling or declaring a function, if it can't, then you gotta specify them.\n- [Compiler] Compiler shouldn't try to guess union types, yet.\n- [Language] Built-in return var name(s)\n- [Language] Support for union types and tuples\n- [Syntax] A unit of indentation is `\\t`\n- [Syntax] There are no keywords, all keywords are symbols\n- \n### Brought up, but not yet agreed:\n\n- [Syntax] ???\n    - zerg: 'Makes a clear distinction between keywords/operators and functions, ignoring that operators are secretly functions'\n    - pepe: ? explain\n- [Syntax] Function Type annotations \n    - zerg: 'Inline in function header is more obvious (esp name:type style)'\n    - pepe: 'should be separate from function definition (like in haskell), as they don't actually change the header'\n- [Language] Exception/error handling\n    - Stack unwinding problem briefly touched on\n    - Idea that errors and exceptions should/could be different\n    - zerg: 'you have to handle the exceptions right away'\n    - zerg: 'value should never be set to an error; program should crash if unhandled error'\n    - pepe: 'exceptions are just values, return them as union'\n    - pepe: 'strong dislike for try/catch, however ignoring errors is a real problem'\n- [Syntax] Semicolons/braces (statement termination/block bounding)\n    - zerg: 'don't indent a single statement'\n    - pepe: 'don't make long lines, all code should be readable in portrait'\n- [Language] Type matching\n    - ?\n\n:ok_hand: \n\n## High level notes\n\n- functional inpsired\n- strongly typed\n    - Support Typeclasses\n    - Generics on generics (this is far fetched maybe)\n    - would**N'T** have too many built in types\n    - co and contravariance\n- no semicolons\n- simple\n- significant whitespace \n- heavy use of vertical space\n- write vscode extension for assistance etc\n- Top level statements should be valid to make it super easy to write simple programs (like in C#9 and python)\n    - An interpreter would be ideal, but not necessary\n\n## Async notes\n\n- Zerg plants🌱 on starting this one\n\n\n## Ideas \n\n- I'd prefer writing initial compiler in C# until the lang is turing complete\n    - Probably a good idea to maintain a compiler in another language. C# is as good as any. Just in case.\n- command line tool, something like `wai`\n    - I'd keep `wai` both implement the package manager and the compilation tools\n    - Another way is to have `waic` (compiler) and `waip` (package manager) separate\n        - This is preferred as it keeps the command namespaces a bit cleaner (eg. tab completion is more reliable), just ensure they always get packaged together.\n    - `wai run/build` to run/build the project\n    - `wai pkg`\n        - `wai pkg list` - list installed packages\n        - `wai pkg i <pkg name>` - install a package\n        - `wai pkg search pattern` - search for packages online using a pattern\n- type inference\n- I don't like = being both comparison and assignment\n- have support for `declare` key word to define aliases (for exmaple `declare true = 1`)\n- \n\n## Keywords\n\n### Generals\n- `#` - single line comment (i wouldn't support multiline comments, just use # in each line)\n\n### Built in types \n:warning: *I'd keep these to a bare minimum*\nnew:\n###\tTypes\n- I'm more in favor of having signs represent the built in types, not words, for exammple\n- x :# would be a variable named x which is a number (integer)\n- y :. would be a variable named y which is a number (decimal)\n- z :' would be a variable named z which is a string \n### Sizes \n- Some options:\n    - Have 32, 64 and native sized types, or\n    - Have 32 and 64 sized types\n    - or have only native sized types\n- In case we opt for specifying the size, i'd go for something like :#32, :#64 or :.32, :.64 Opinion?\n\nold, obsolete:\n- `int` 64 bit integer?\n- `dec` decimal value\n- `str`\n- `char`\n- `bool`\n- ?\n\n## code samples\n:red_circle: Nothing is final\n\nI think it's a good idea to have full code example at any iteration, to see how things look out in practicality. It should also accomplish a real world task.\n\nTask 1:\n*Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.*\n\n```haskell\niter [1..100] \n     x ->> \n         let f = x % 5 eq 0\n             b = x % 3 eq 0\n         \n         ? not (f or b) \n             -> print str x\n             ->>\n                 ? f -> print 'Fizz'\n                 ? b -> print 'Buzz'\n         \n         print ' '\n```\n\n\nRandom sample of an early pepega's vision of type matching\n```hs\nclass Ex1\nclass Ex2\nclass Ex3\n\ntype Ex = Ex1 | Ex2 | Ex3\n\n# we actually haven't figured out how to return yet lol but w/e\nstr | Ex: str\ntest input\n    -> input == "1" ?  \n        return new Ex1 # fine because return value is int or Ex, and Ex can be Ex1\n    -> input == "2" ?\n        return new Ex2 \n    -> input == "3" ?\n        return new Ex3\n    -> return "Sucess: " + input \n    \nlet myVal = test "uwu"    \n\n# to get the value we gotta match to figure out the type\n\nmatch myVal\n    case e: Ex -> match e\n        case Ex1 e1 -> print "Error is Ex1"\n        case Ex2 e2 -> print "Error is Ex2"\n        case Ex3 e3 -> print "Error is Ex3"\n    otherwise s -> print "Value is " + s \n    # here we know its a string because that's the only thing it can be, if it didn't match Ex\n        # we also get juicy exhaustive match check this way too. If we don't handle\n        # all possible types, the compiler will give error\n        # we can also reverse order btw, to get what you want.\n```\n\n#### 
