GithubHelp home page GithubHelp logo

reusepatterns.jl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

reusepatterns.jl's Issues

`Array` composition

Consider the following:

mwe

using ReusePatterns

struct MyArray{T, N}  # <: AbstractArray{T, N}
  a::Array{T, N}
  attr::Int
  MyArray(T, dims::NTuple{N, Int}) where {N} = new{T, N}(zeros(T, dims...), 1)
end

@forward((MyArray, :a), Array)

main() = begin
  a = MyArray(Float64, (2, 2, 2))
  @show size(a)
  return
end

main()

It fails with:

ERROR: LoadError: MethodError: no method matching eval(::Expr)
You may have intended to import Base.eval
Closest candidates are:
  eval(::Module, ::Any) at boot.jl:368
Stacktrace:
 [1] (::ReusePatterns.var"#newmethod#2")(sender_type::String, sender_symb::String, argid::Vector{Int64}, method::Method, withtypes::Bool, allargs::Bool)
   @ ReusePatterns [...]/ReusePatterns.jl/src/ReusePatterns.jl:60
 [2] forward(sender::Tuple{UnionAll, Symbol}, receiver::Type, method::Method; withtypes::Bool, allargs::Bool)
   @ ReusePatterns [...]/ReusePatterns.jl/src/ReusePatterns.jl:104
 [3] forward
   @ [...]/ReusePatterns.jl/src/ReusePatterns.jl:45 [inlined]
 [4] forward(sender::Tuple{UnionAll, Symbol}, receiver::Type; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ ReusePatterns [...]/ReusePatterns.jl/src/ReusePatterns.jl:125
 [5] forward
   @ [...]/ReusePatterns.jl/src/ReusePatterns.jl:122 [inlined]
 [6] top-level scope
   @ [...]/ReusePatterns.jl/src/ReusePatterns.jl:180
in expression starting at [...]/composition.jl:9

Is something similar supported ?

Weird error with parametric types

I ran into a version of the following minimal example:

using ReusePatterns

@quasiabstract AbstractTest{N, T}
    f::NTuple{N, T}
end

@quasiabstract AbstractTest2{N}
    f::NTuple{N, Number}
end

@quasiabstract Test <: AbstractTest{2, Number} end

@quasiabstract Test2 <: AbstractTest2{2} end

Then, Test( (1, 1.0) ) produces an error, while Test2( (1, 1.0) ) does not, although they should give the exact same thing. The exact error is

TypeError: in new, expected Tuple{Vararg{T, N}} where {N, T}, got a value of type Tuple{Int64, Float64}

Interation with DataStructures causes error

Thanks for this package! tracked down a subtle error/potential bug...

using DataStructures, HDF5, ReusePatterns

mutable struct DsetWrapper
    dset::HDF5.Dataset
end

@forward((DsetWrapper,:dset),HDF5.Dataset)

ERROR: LoadError: cannot assign a value to variable DataStructures.list from module Main

Breaks precompilation

When I use ReusePatterns in my own scripts it seems to work fine, but I am unable to use in a package/project.

module TestReuse
using ReusePatterns, HDF5

struct DsetWrapper
    dset::HDF5.Dataset
end

@forward((DsetWrapper,:dset),HDF5.Dataset)
end
ERROR: LoadError: Evaluation into the closed module `HDF5` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `HDF5` with `eval` during precompilation - don't do this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.