Created
September 1, 2023 09:15
-
-
Save farism/14954a520a7ad40a55d9796a3b0fc61f to your computer and use it in GitHub Desktop.
Mint lang 0.18 feedback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1b. Bug: lifecycle method causes with a comments but no return causes exception in compiler | |
``` | |
component Main { | |
connect App exposing { method } | |
fun componentDidMount { | |
// foo | |
} | |
fun render : Html { | |
<div /> | |
} | |
} | |
``` | |
``` | |
Index out of bounds (IndexError) | |
mint in 'raise<IndexError>:NoReturn' | |
mint in 'Mint::TypeChecker#check<Mint::Ast::Block>:(Mint::TypeChecker::Record+ | Mint::TypeChecker::Type | Mint::TypeChecker::Variable)' | |
mint in 'Mint::TypeChecker#resolve<Mint::Ast::Block>:(Mint::TypeChecker::Record+ | Mint::TypeChecker::Type | Mint::TypeChecker::Variable)' | |
mint in 'Mint::TypeChecker#check<Mint::Ast::Function>:Mint::TypeChecker::Type' | |
mint in 'Mint::TypeChecker#resolve<Mint::Ast::Function>:(Mint::TypeChecker::Record+ | Mint::TypeChecker::Type | Mint::TypeChecker::Variable)' | |
mint in 'Mint::TypeChecker#check<Mint::Ast::Component>:Mint::TypeChecker::Type' | |
mint in 'Mint::TypeChecker#resolve<Mint::Ast::Component>:(Mint::TypeChecker::Record+ | Mint::TypeChecker::Type | Mint::TypeChecker::Variable)' | |
mint in 'Mint::TypeChecker#check<Mint::Ast>:Mint::TypeChecker::Type' | |
mint in 'Mint::Builder#initialize<Bool, Bool, Bool, Bool, (String | Nil)>:Nil' | |
mint in 'Mint::Cli#parse_and_run:Nil' | |
mint in '__crystal_main' | |
mint in 'main'``` | |
``` | |
2b. Bug: Alphabetical sort of entities causes comments to shift around | |
``` | |
module Mod { | |
// comments | |
fun functionB() { | |
} | |
// these comments | |
// will be shifted around | |
// after functionA is sorted to be above function B | |
// comments | |
fun functionA() { | |
} | |
} | |
``` | |
3b. Bug: Trying to use non existent doesnt cause type errors | |
``` | |
fun roundedRect(x: Number, y : Number, w: Number, h : Number, radii : Arraya(Number) // notice it's spelled `Arraya`, but this never threw an error. Typos tripped me up a handful of times | |
``` | |
4b. Bug: @format strips inlined js IIFE blocks and replaces with the content hash | |
``` | |
let {result, code} = | |
@format { | |
let draw = | |
() { | |
case Dom.Canvas.fromDomElement(canvas) { | |
Maybe::Just(el) => | |
{ | |
el | |
|> Canvas.setFont("48px serif") | |
|> Canvas.fillText("Hi!", 150, 50) | |
|> Canvas.setDirection(CanvasDirection::RTL) | |
|> Canvas.fillText("Hi!", 150, 130) | |
` | |
(() => { | |
// this | |
// is | |
// a stripped out | |
// iife | |
})() | |
` | |
"" | |
} | |
Maybe::Nothing => | |
"" | |
} | |
} | |
``` | |
``` | |
let draw = | |
() { | |
case Dom.Canvas.fromDomElement(canvas) { | |
Maybe::Just(el) => | |
{ | |
el | |
|> Canvas.setFont("48px serif") | |
|> Canvas.fillText("Hi!", 150, 50) | |
|> Canvas.setDirection(CanvasDirection::RTL) | |
|> Canvas.fillText("Hi!", 150, 130) | |
`7ac0193fd8c2b65e81cb0e79993659c6` | |
"" | |
} | |
Maybe::Nothing => | |
"" | |
} | |
} | |
``` | |
5b. Bug: Can’t comment out items in the middle of an array | |
[ | |
// “Hello”, this breaks | |
“World”, | |
] | |
6b. Bug: Can’t comment out function call in the middle a pipeline | |
myArr | |
|> Array.select | |
// |> Array.map - this breaks | |
|> Array.first | |
7b. Bug: Not putting spaces around `|>` pipe operator should be valid syntax and corrected by formatter | |
8b. Bug: Sometimes the mint process would cache a type and keep marking it as a duplicate type, even after renaming it. This was usually caused by copy/pasting a file with a component or module in it. The module name would be cached. After renaming the module/component in the duplicated file I would keep getting errors about type already existing. I couldn’t figure out how to clear the type cache. Tried restarting VS code, tried killing all the mint executables, etc, but it would persist for a while and then randomly go away on its own. | |
10b. Bug: Allows invalid syntax regarding constants | |
``` | |
suite "Canvas" { | |
const FOO = 2 | |
test "setShadowBlur | getShadowBlur" { | |
FOO("hellow") // why can I call this like a function? | |
} | |
} | |
``` | |
1f. Feature: Formatting and typechecking should be separate. This was a fairly large productivity killer for me as a new user to the language. | |
- If a file is syntactically correct it should format correctly. | |
- Isolated syntax and typechecking errors should not break typechecking and formatting on other files in the project | |
2f. Feature: Better `Debug.log` output. | |
- Complex objects should pretty print | |
- Enums should print as enums, | |
- Records should print with their record name, etc | |
- Coercion to string would be handy when interpolating values,e .g. “#{bool}” should work without having to do “#{Bool.toString(bool)}” | |
3f. Feature: mint test watch mode | |
4f. Feature: mint test dom snapshot testing (dom) | |
5f. Feature: mint test visual snapshot diff testing (e.g. percy/chromatic) | |
6f. Feature: mint test run tests by filename | |
7f. Feature: inline doc tests (like elixir doctests https://elixir-lang.org/getting-started/mix-otp/docs-tests-and-with.html#doctests) | |
8f. Feature: Allow defining helper functions fun inside “suite” and “test” blocks | |
``` | |
suite "Tests" { | |
fun helperHere() { | |
} | |
test "it does something" { | |
fun orHere() { | |
} | |
} | |
} | |
``` | |
9f. Feature: Allow referencing components with `as` inside of `test` blocks. Currently you get an error “Referencing elements are not allowed outside of components.” | |
``` | |
suite "Tests" { | |
fun helperHere() { | |
} | |
test "it does something" { | |
<canvas as canvas /> // can this be allowed? | |
} | |
} | |
``` | |
10f. Feature: `use Module` in scope to access `Module` members without qualifying the module name | |
11f. Feature: Ability to specify module members as private to hide them from generated docs, autocomplete, etc | |
12f. Feature: Not really sure if there is a solve for this, but I found myself getting a little frustrated with multiline `case` branch statements and `Tuple` syntax conflicts | |
- Case branches need to match return type | |
- Commenting out a multiline case branch to where there is only one line remaining converts the type into a Tuple | |
- Adding braces around a single-line branch expression because you plan to add more lines to it turns it into a Tuple, forcing you to add garbage lines to make it into a multiline block, just to get it to compile | |
- I found myself going through this process quite bit during coding. | |
- This, combined with no formatting if typecheck fails, was a bit annoying when trying to format a bunch of nested, but incorrectly indented, code | |
1l. LS: vscode outline shows no members in mint file | |
2l. LS: autocompleting on the last part of a code entry causes the full autocomplete to be templated. E.g. if I type | |
- `Colors::Gree` and autocomplete, it will result in `Colors::GreeColors::Green` | |
- This happens on methods too `Window.getElementByI` autocomplete will result in `Window.getElementByIWindow.getElementById()` | |
Core JavaScript runtime | |
- Why is DateFNs included https://github.com/mint-lang/mint-runtime/blob/master/source/Main.js#L69-L80 ? | |
- It is taking up roughly ~27kb of the ~67kb bundle but I don’t see any of the functions being used by the stdlib. | |
- I only see one being used by the doc-viewer. | |
Generally speaking, what is the need to have the core runtime be a separate javascript repo? It seems like with the JS interop features in Mint you could write most of this runtime in Mint. | |
Writing runtime in Mint would allow for better treeshaking, which currently isn’t possible with the runtime right now. E.g. the `TestContext`, and other things that aren’t used, have their runtime code put into production bundles, which doesn’t really make sense. | |
1d. Documentation: Doc viewer should be reconciled (and probably supersede) the documentation viewer built into `mint-rails-website`. I think doc viewer should be the primary way of building doc pages, so people can easily publish their own static doc site without needing to run a Rails server. | |
2d. Documentation: Add section about using `window.isActiveUrl` for highlighting active links/breadcrumbs in routing docs | |
3d. Documentation: How to deal with trailing slashes in routes? | |
4d. Documentation: Need a full blown section on testing, using mint test, how to use Test.Context, Test.Html etc | |
5d. Documentation: Best practices regarding module naming and resulting file structure | |
6d. Documentation: How to use await in @format block? | |
1p. Performance: linting and formatting became really slow on large file (1k+ lines). Takes multiple seconds to run each. But only while operating on that one file. Editing files in the rest of the application still has good performance. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment