Comments (1)
While looking at this issue, I learned for the first time about [<ParamList>]
attribute.
According to the changelog and the Fable.Core doc comment, it seems to only exist for Fable.React...
Changelog
## 3.0.0-nagareyama-alpha-003 - 2020-09-14
* Fix: Add names with $reflection suffix to root scope
* Fix deriving from imported JS classes
* Keep support for ParamList attribute until removed from Fable.React
Fable.Core
/// Used to spread the last argument. Mainly intended for `React.createElement` binding, not for general use.
[<AttributeUsage(AttributeTargets.Parameter)>]
type ParamListAttribute() =
inherit Attribute()
type ParamSeqAttribute = ParamListAttribute
Looking thought the code and after an empiric test,
I am unsure what the effect of [<ParamList>]
attributes is, looking through the code it seems to be of the same effect as when we use [<ParamArray>]
.
IHMO If that's confirmed it would be nice, to remove it in a future major version of Fable.
With that said, while testing what happen if we remove that attribute I discovered that the code should still be working without but it would not save the few extra bytes that you mentioned which is probably not what we want.
// With [<ParamList>]
export function f() {
const children_4 = [react.createElement("div", {}), react.createElement("span", {})];
return react.createElement("div", {}, ...children_4);
}
// Without [<ParamList>]
export function f() {
const children_4 = [react.createElement("div", {}, []), react.createElement("span", {}, [])];
return react.createElement("div", {}, children_4);
}
// With [<ParamArray>]
export function f() {
const children_4 = [react.createElement("div", {}), react.createElement("span", {})];
return react.createElement("div", {}, ...children_4);
}
Regarding the creation of the intermediate variable children_4
, I am unsure how Fable decide to create it. What I mean by that is why Fable create a intermediate variable for children
and not for the properties object {}
in the exemple Without [<ParamList>]
.
from fable.
Related Issues (20)
- Best practise for native files in .fsproj HOT 13
- Latest Fable fails to compile Fable.React HOT 1
- [BUG-Python] Fable 4.8.1 fails in decimal.ToString() with CultureInfo
- Check why Fable.Compiler didn't have a symbol package pushed HOT 2
- [TypeScript] IDictionary and IReadOnlyDictionary interfaces HOT 2
- Setup Prerequisites Docs .NET Version Needs Updating HOT 3
- Task vs Promise HOT 6
- [Python] Nested type with Custom Hashcode fails HOT 3
- Shorthand syntax for static member no longer works HOT 6
- How to format floats? HOT 1
- Reference to JSX Component generates inline function, a lost state and performance problem
- The TypeScript file generated by Fable tries to import a file with a .js extension that does not exist HOT 6
- Fable.sln does not restore HOT 4
- Creating a `DateTime` with `DateTimeKind` should use the `DateTimeKind` and not a literal int
- [Python] How to works with `Kind` property on the `DateTime` type? HOT 2
- [JavaScript] Makes a pass on the implementation of `DateTime.ToString` HOT 1
- [Fable 4.3.0][F# 7.0] String interpolation shows error (but compiles fine) HOT 2
- Somethings feels wrong with Fable console output (logs are not added in the correct place)
- Compiler generates invalid Javascript when composing functions with partial application HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fable.