{"action":"created","issue":{"url":"https://api.github.com/repos/fable-compiler/Fable/issues/1370","repository_url":"https://api.github.com/repos/fable-compiler/Fable","labels_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1370/labels{/name}","comments_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1370/comments","events_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1370/events","html_url":"https://github.com/fable-compiler/Fable/issues/1370","id":307343112,"node_id":"MDU6SXNzdWUzMDczNDMxMTI=","number":1370,"title":"Helping with Fable 2 development","user":{"login":"alfonsogarciacaro","id":8275461,"node_id":"MDQ6VXNlcjgyNzU0NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/8275461?v=4","gravatar_id":"","url":"https://api.github.com/users/alfonsogarciacaro","html_url":"https://github.com/alfonsogarciacaro","followers_url":"https://api.github.com/users/alfonsogarciacaro/followers","following_url":"https://api.github.com/users/alfonsogarciacaro/following{/other_user}","gists_url":"https://api.github.com/users/alfonsogarciacaro/gists{/gist_id}","starred_url":"https://api.github.com/users/alfonsogarciacaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alfonsogarciacaro/subscriptions","organizations_url":"https://api.github.com/users/alfonsogarciacaro/orgs","repos_url":"https://api.github.com/users/alfonsogarciacaro/repos","events_url":"https://api.github.com/users/alfonsogarciacaro/events{/privacy}","received_events_url":"https://api.github.com/users/alfonsogarciacaro/received_events","type":"User","site_admin":false},"labels":[{"id":805139402,"node_id":"MDU6TGFiZWw4MDUxMzk0MDI=","url":"https://api.github.com/repos/fable-compiler/Fable/labels/dev2.0","name":"dev2.0","color":"f3f7a5","default":false},{"id":309670958,"node_id":"MDU6TGFiZWwzMDk2NzA5NTg=","url":"https://api.github.com/repos/fable-compiler/Fable/labels/help%20wanted","name":"help wanted","color":"159818","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":24,"created_at":"2018-03-21T17:22:45Z","updated_at":"2018-06-21T14:55:16Z","closed_at":null,"author_association":"MEMBER","body":"Not sure if the `dev2.0` branch is already in a state where I can start calling for help, but I'll do it anyway :wink: I'm listing below the main changes that are happening in that branch, how can you quickly test it out and which tasks are pending for the first alpha release. If you're interested in helping with any of them, please comment below so I can give more details to work together 💪 \r\n\r\n## Non-comprehensive list of main changes\r\n\r\n- Fable AST now includes some of the most common constructs in F# (list, option...) so it's easier to change their representation in JS if necessary. Also, the AST now keeps type information from the F# compiler.\r\n- Records and unions won't be compiled as JS _classes_ but as plain objects and arrays respectively.\r\n- All type methods are compiled now as JS module functions for better compatibility with tree shaking (hopefully it should also help JS engines optimize the code). The only exception is override methods (ToString, Equals), which are attached to the prototype. Also, nested module functions are compiled as functions of the file root module with mangled names.\r\n- When casting an instance to an interface, it will be wrapped with an object containing the interface functions, this prevents name conflicts among interfaces (and it's also necessary because methods are not attached to the prototype anymore).\r\n- Some modules in fable-core (like List or Array) are now written in F#\r\n- Optimizations applied to the Fable AST are now isolated passes happening in `FableTransforms`. This should make the code more maintainable than Fable 1, where optimizations are usually applied in multiple places (specially the uncurrying optimization, which hopefully will work much better in Fable 2). Some optimizations, however, still have to be done in the last Fable2Babel pass: tail-calls and decision trees (pattern matching).\r\n\r\n## Give it a quick try\r\n\r\n- Clone the repository if you haven't already\r\n- `git checkout dev2.0`\r\n- `cd src/tools`\r\n- `bash quicktest.sh --build-core`\r\n\r\nThis will compile and execute the `QuickTest.fs` file in the same folder. Feel free to use it as a playground to test Fable 2 features (but please don't include it in your PRs). The second time, if `src/js/fable-core` files haven't changed you can just run `bash quicktest.sh` (if `src/dotnet/Fable.Compiler` files haven't changed you can also run `bash quicktest.sh --no-build` but with 2.1.300-preview1 building a project with no changes should be quite fast anyways).\r\n\r\n> On Windows you should be able to run the script using Git bash.\r\n\r\n## Pending tasks\r\n\r\n- There is a number of `TODO!!!` comments spread through the code, I should probably handle those myself.\r\n\r\n- As plugins won't be included in the first alpha release, **tests use now Expecto API**, which is much easier to share with JS test runners. I've converted already some files (ArithmeticTests, ArrayTests, ListTests) but most of them are still waiting for some love. I was using Regex to change the signature of the methods to `testCase` but probably it's a good idea to write a script for it. One of the main challenges is that, given tests are values in a list now, extra functions that appear in the middle of the file must be moved to the top, which may shadow other values in some cases.\r\n\r\n- **Set and Map modules in fable-core** have to be ported to F#. I partially did it for Set (Map can also be taken from [FunScript repo](https://github.com/ZachBray/FunScript/blob/master/src/main/FunScript/Core/Map.fs) where I originally ~~stole it~~ took inspiration from). We need to be sure they are correctly compiled to JS, the public function names are exposed correctly, check if we need to port methods from the previous .ts files (saved in `src/tools/old`) and if the tests are working correctly.\r\n\r\n- Because the AST has changed so much, **most of the Replacements module needs to be rewritten**. I already did around 1000 lines and there's another thousand to go. This is a bit of a tedious task, but if someone is crazy enough to take on it, please let me know. Maybe the fastest way is to have a screen sharing session to show you what needs to be done and then split the remaining code so we can finish faster.\r\n\r\n> Things that won't be included in the first alpha release: bigint, reflection, plugins.\r\n\r\nI hope that's enough info for now, thanks a lot for your help in advance!"},"comment":{"url":"https://api.github.com/repos/fable-compiler/Fable/issues/comments/399132962","html_url":"https://github.com/fable-compiler/Fable/issues/1370#issuecomment-399132962","issue_url":"https://api.github.com/repos/fable-compiler/Fable/issues/1370","id":399132962,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTEzMjk2Mg==","user":{"login":"Alxandr","id":112334,"node_id":"MDQ6VXNlcjExMjMzNA==","avatar_url":"https://avatars0.githubusercontent.com/u/112334?v=4","gravatar_id":"","url":"https://api.github.com/users/Alxandr","html_url":"https://github.com/Alxandr","followers_url":"https://api.github.com/users/Alxandr/followers","following_url":"https://api.github.com/users/Alxandr/following{/other_user}","gists_url":"https://api.github.com/users/Alxandr/gists{/gist_id}","starred_url":"https://api.github.com/users/Alxandr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alxandr/subscriptions","organizations_url":"https://api.github.com/users/Alxandr/orgs","repos_url":"https://api.github.com/users/Alxandr/repos","events_url":"https://api.github.com/users/Alxandr/events{/privacy}","received_events_url":"https://api.github.com/users/Alxandr/received_events","type":"User","site_admin":false},"created_at":"2018-06-21T14:55:16Z","updated_at":"2018-06-21T14:55:16Z","author_association":"NONE","body":"Question considering the new way of dealing with methods and interfaces; how will the following be handled?\r\n\r\n```fsharp\r\ntype Base () =\r\n  abstract M: unit -> string\r\n  default __.M () = \"base\"\r\n\r\ntype A () =\r\n  inherit Base ()\r\n  member __.M () = \"a\" // NOTE: Not override, hides parent M\r\n\r\ntype B () =\r\n  inherit Base ()\r\n  override __.M () = \"b\"\r\n\r\nlet a = A ()\r\nlet b = B ()\r\n\r\nprintfn \"%s\" <| (a :> Base).M ()\r\nprintfn \"%s\" <| (b :> Base).M ()\r\n```"}}
{"actor":{"display_login":"Alxandr"}}