question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Helping with Fable 2 development

See original GitHub issue

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 😉 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 💪

Non-comprehensive list of main changes

  • 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.
  • Records and unions won’t be compiled as JS classes but as plain objects and arrays respectively.
  • 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.
  • 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).
  • Some modules in fable-core (like List or Array) are now written in F#
  • 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).

Give it a quick try

  • Clone the repository if you haven’t already
  • git checkout dev2.0
  • cd src/tools
  • bash quicktest.sh --build-core

This 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).

On Windows you should be able to run the script using Git bash.

Pending tasks

  • There is a number of TODO!!! comments spread through the code, I should probably handle those myself.

  • 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.

  • 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 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.

  • 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.

Things that won’t be included in the first alpha release: bigint, reflection, plugins.

I hope that’s enough info for now, thanks a lot for your help in advance!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:37 (32 by maintainers)

github_iconTop GitHub Comments

4reactions
MangelMaximecommented, Apr 18, 2018

Just for info, if someone is porting the test files no need to port SetTests.fs and MapTests.fs I will do it to test the module intergration.

Also, if you use VSCode, you can use multiple selection to do all the work at once inside a file. Writing a scripting seems a bit over engeneering here 😃.

2018-04-18 15 14 27

3reactions
zaaackcommented, Apr 10, 2018

Thanks for your quick and detailed reply, I’ll try it tomorrow.

I’m also working in the Replacements module. I can tackle the collections (Seq, List, Array) while you complete the other functions, what do you think?

Great, I think I can spend two hours on weekdays and full day on weekends, mostly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Westcliff Development | The Fable Wiki - Fandom
Westcliff Development is a pre-Spire quest in Fable II. Barnum needs 5,000 gold for his new building plans to turn Westcliff into a...
Read more >
Apparently, Eidos Montreal is helping with the ...
I just want any studio to remember that the spirit of Fable is the world reacting to the player. That's the most unique...
Read more >
Fable II - Westcliff Development Quest Help - GameFAQs
What i have done so far. Entered Westcliff. Found Barnum and paid him 5000 (as soon as i paid him 5000 i walked...
Read more >
Making of - Fable 2 - YouTube
Interview with the developers of Fable 2. Source: https://www.youtube.com/user/FableTheGame.
Read more >
Fable II Mission Westcliff Development - YouTube
Hello my name is Visual Walkthrough i am here to help you out with a game called Fable II (Xbox 360).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found