Julia 0.5.0 发布了,本次更新包括了很多新的语言特性。

转载:https://github.com/vuejs/babel-plugin-transform-vue-jsx/blob/master/README.md

Julia是一个新的高性能动态高级编程语言。语法和其他编程语言类似,易于其他语言用户学习。Julia拥有丰富的函数库,提供了数字精度、精致的增幅
器(sophisticated
amplifier)和分布式并行运行方式。核心函数库等大多数库是由Julia编写,但也用成熟的C和FORTRAN库来处理线性代数、随机数产生和字
符串处理等问题。Julia语言可定义函数并且根据用户自定义的参数类型组合再进行重载。

babel-plugin-transform-vue-jsx

澳门新葡亰8455下载app 1

CircleCI

Babel plugin for Vue 2.0 JSX

部分更新内容如下:

Requirements

  • Assumes you are using Babel with a module bundler e.g. Webpack,
    because the spread merge helper is imported as a module to avoid
    duplication.

  • This is mutually exclusive with babel-plugin-transform-react-jsx.

  • Generator expressions: `f(i) for i in 1:n` ([#4470]). This
    returns an iterator that computes the specified values on demand.
    This is useful for computing, e.g.

  • `sum(f(i) for i in 1:n)` without creating an intermediate array of
    values.

  • Generators and comprehensions support filtering using `if`
    ([#550]) and nested iteration using multiple `for` keywords
    ([#4867]).

  • Fused broadcasting syntax: “f.(args…)“ is equivalent to
    “broadcast(f, args…)“ ([#15032]), and nested
    `f.(g.(args…))` calls are fused into a single `broadcast` loop
    ([#17300]).

  • Similarly, the syntax `x .= …` is equivalent to a
    `broadcast!(identity, x, …)`call and fuses with nested “dot”
    calls; also, `x .+= y` and similar is now equivalent to `x .= x
    .+ y`, rather than `x = x .+ y` ([#17510]).

  • Macro expander functions are now generic, so macros can have
    multiple definitions(e.g. for different numbers of arguments, or
    optional arguments) ([#8846], [#9627]).

  • However note that the argument types refer to the syntax tree
    representation, and not to the types of run time values.

  • Varargs functions like `foo{T}(x::T…)` may now restrict the
    number of such arguments using `foo{T,N}(x::Vararg{T,N})`
    ([#11242]).

  • `x ∈ X` is now a synonym for `x in X` in `for` loops and
    comprehensions, as it already was in comparisons ([#13824]).

  • The `PROGRAM_FILE` global is now available for determining the
    name of the running script ([#14114]).

  • The syntax `x.:sym` (e.g. `Base.:+`) is now supported, while
    using `x.(:sym)` or `x.(i)` for field access are deprecated in
    favor of `getfield` ([#15032]).

  • Function return type syntax `function f()::T` has been added
    ([#1090]). Values returned from a function with such a
    declaration will be converted to the specified type `T`.

  • Many more operators now support `.` prefixes (e.g. `.≤`)
    ([#17393]).  However, users are discouraged from overloading
    these, since they are mainly parsed in order to implement backwards
    compatibility with planned automatic broadcasting of dot operators
    in Julia 0.6 ([#16285]).  Explicitly qualified operator names
    like `Base.≤` should now use `Base.:≤` (prefixed by
    `@compat` if you need 0.4 compatibility via the `Compat`
    package).

  • User-extensible bounds check elimination is now possible with the
    new `@boundscheck` macro ([#14474]). This macro marks bounds
    checking code blocks, which the compiler may remove when encountered
    inside an `澳门新葡亰8455下载app,@inbounds` call.

Usage

npm install
  babel-plugin-syntax-jsx
  babel-plugin-transform-vue-jsx
  babel-helper-vue-jsx-merge-props
  babel-preset-es2015
  --save-dev

In your .babelrc:

{
  "presets": ["es2015"],
  "plugins": ["transform-vue-jsx"]
}

The plugin transpiles the following JSX:

<div id="foo">{this.text}</div>

To the following JavaScript:

h('div', {
  attrs: {
    id: 'foo'
  }
}, [this.text])

Note the h function, which is a shorthand for a Vue instance’s
$createElement method, must be in the scope where the JSX is. Since
this method is passed to component render functions as the first
argument, in most cases you’d do this:

Vue.component('jsx-example', {
  render (h) { // <-- h must be in scope
    return <div id="foo">bar</div>
  }
})

点击完整更新日志查看更多内容

h auto-injection

Starting with version 3.4.0 we automatically inject
const h = this.$createElement in any method and getter (not functions
or arrow functions) declared in ES2015 syntax that has JSX so you can
drop the (h) parameter.

Vue.component('jsx-example', {
  render () { // h will be injected
    return <div id="foo">bar</div>
  },
  myMethod: function () { // h will not be injected
    return <div id="foo">bar</div>
  },
  someOtherMethod: () => { // h will not be injected
    return <div id="foo">bar</div>
  }
})

@Component
class App extends Vue {
  get computed () { // h will be injected
    return <div id="foo">bar</div>
  }
}
网站地图xml地图