Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reserve syntax that could be used for computed field types #26816

Merged
merged 1 commit into from
Apr 17, 2018

Conversation

JeffBezanson
Copy link
Member

@JeffBezanson JeffBezanson commented Apr 15, 2018

This will allows us to implement #18466 in a non-breaking way. Example:

julia> struct Foo{T}
           x::T
           y::eltype(T)
       end
ERROR: syntax: unsupported field type expression "eltype(T)"

Specifically, this disallows call expressions containing type parameters.

@JeffBezanson JeffBezanson added breaking This change will break code compiler:lowering Syntax lowering (compiler front end, 2nd stage) labels Apr 15, 2018
@ararslan ararslan added the needs news A NEWS entry is required for this change label Apr 15, 2018
@JeffBezanson
Copy link
Member Author

Putting this in NEWS might just add noise --- I don't believe there's anything useful you can do with this syntax currently.

@JeffBezanson JeffBezanson merged commit a6f6b5b into master Apr 17, 2018
@JeffBezanson JeffBezanson deleted the jb/computedftsyntax branch April 17, 2018 19:28
@o314
Copy link
Contributor

o314 commented Apr 18, 2018

What about

 struct Foo{T}
   x::T
   y::synthetic(T)
end

or

 struct Foo{T}
   x::T
   y::generated(T)
end

My 2cts

@o314
Copy link
Contributor

o314 commented Apr 18, 2018

@JeffBezanson

I don't believe there's anything useful you can do with this syntax currently.

Will be very interesting to embed into a graph (LightGraphs.jl ?) or db (JuliaDB ?) library to handle the (re)computing of derived properties, metrics etc.

When the time has come, of course...

@yuyichao
Copy link
Contributor

Putting this in NEWS might just add noise --- I don't believe there's anything useful you can do with this syntax currently.

Actually https://github.com/simonster/StructsOfArrays.jl/pull/7/files#diff-04c6e90faac2675aa89e2176d2eec7d8R71

@yuyichao
Copy link
Contributor

What it does is still possible assuming this is still allowed. It's nonetheless something useful that can be done currently with the syntax though.

@JeffBezanson
Copy link
Member Author

Ok, you're right. Maybe this should be a deprecation warning instead? Or continue to allow the current syntax, and require something like field::@defer f(Vector{T}) in the future for deferred field types?

@JeffBezanson JeffBezanson added the triage This should be discussed on a triage call label Apr 19, 2018
@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Apr 19, 2018
mbauman added a commit that referenced this pull request Apr 19, 2018
* origin/master: (22 commits)
  separate `isbitstype(::Type)` from `isbits` (#26850)
  bugfix for regex matches ending with non-ASCII (#26831)
  [NewOptimizer] track inbounds state as a per-statement flag
  change default LOAD_PATH and DEPOT_PATH (#26804, fix #25709)
  Change url scheme to https (#26835)
  [NewOptimizer] inlining: Refactor todo object
  inference: enable CodeInfo method_for_inference_limit_heuristics support (#26822)
  [NewOptimizer] Fix _apply elision (#26821)
  add test case from issue #26607, cfunction with no args (#26838)
  add `do` in front-end deparser. fixes #17781 (#26840)
  Preserve CallInst metadata in LateLowerGCFrame pass.
  Improve differences from R documentation (#26810)
  reserve syntax that could be used for computed field types (#18466) (#26816)
  Add support for Atomic{Bool} (Fix #26542). (#26597)
  Remove argument restriction on dims2string and inds2string (#26799) (#26817)
  remove some unnecessary `eltype` methods (#26791)
  optimize: ensure merge_value_ssa doesn't drop PiNodes
  inference: improve tmerge for Conditional and Const
  ensure more iterators stay type-stable
  code loading docs (#26787)
  ...
@mauro3
Copy link
Contributor

mauro3 commented Apr 20, 2018

Was the triage decision to use field::@defer f(Vector{T})? Or why was this reverted?

@yuyichao
Copy link
Contributor

require something like field::@defer f(Vector{T}) in the future for deferred field types

That keeps the semantics consistent with super types, which I assume will probably never support deferred computed types.

@iamed2
Copy link
Contributor

iamed2 commented Apr 20, 2018

@generated struct Foo{T}
    x::T
    y::eltype(T)
end

Maybe?

mbauman added a commit that referenced this pull request Apr 23, 2018
* origin/master: (23 commits)
  fix deprecations of \cdot and \times (#26884)
  Support reshaping custom 0-dimensional arrays (#26870)
  fix some cases of dot syntax lowering (#26878)
  Pkg3: deterministically close the LibGit2 repo in tests (#26883)
  code loading docs: add missing graph edge (#26874)
  add news for #26858 and #26859 [ci skip] (#26869)
  Deprecate using && and || within at-dot expressions (#26792)
  widen `Int8` and `Int16` to `Int` instead of `Int32` (#26859)
  fix #26038, make `isequal` consistent with `hash` for `Ptr` (#26858)
  Deprecate variadic size(A, dim1, dim2, dims...) method (#26862)
  add using Random to example in manual (#26864)
  warn once instead of depwarn since we want to test it
  Revert "reserve syntax that could be used for computed field types (#18466) (#26816)" (#26857)
  Fix compilation on LLVM 6.0
  change promotion behaviour of `cumsum` and `cumsum!` to match `sum`
  [LLVM 6] add patch to diamond if-conversion
  add a precompile command that can be used to precompile all dependencies (#254)
  use registry if no version entry exist in project for developed pacakges
  make Pkg3 work as a drop in for the old CI scripts
  update registries when adding (#253)
  ...
@KristofferC KristofferC removed the needs news A NEWS entry is required for this change label Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will break code compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants