I am trying to "lift" base functions to allow Nullable types to be used 
natively I am getting a stack-overflow error with the following code:

# Test with just a few functions
import Base: get, +, -, /, *, ^

# Function symbols to be lifted
funs = [:+, :-, :/, :*, :^]

# Generic get function
# Assume appropriate get functions are written for each type
function get{T}(x::T)
  x
end

S = Union{Symbol, Expr}

# Lifter function
function lift(fun_name::S, new_type::S)
  quote
    function $fun_name{T}(x...;t::T=x)
    y = Array(Any, length(x))
    for i in 1:length(x)
      y[i] = get(x[i])
    end
    ret = $fun_name(y...)
    return $new_type(ret)
    end
  end
end

# Then lift the functions
for i in funs
  eval(lift(i, :Nullable))
end

When I type in anything else into the interpreter in this case f, I get the 
error message:

WARNING: Caught an exception in the keymap:
ERROR: StackOverflowError:
ERROR: UndefVarError: f not defined

Another odd thing about this error is that it doesn't always happen right 
away and sometimes doesn't happen at all which is odd. I have also tried 
loading the code by include(scriptfile.jl) but the same thing happens

My Environment: Version Info: 0.5.0-dev+433 (2015-09-29 15:39 UTC), Ubuntu 
14.04 x86_64-linux-gnu

DP


Reply via email to