Void
किसी फ़ंक्शन द्वारा लौटाए जाने पर टाइप करने के लिए सबसे अच्छी विधि क्या है? http://docs.julialang.org/en/release-0.5/manual/faq/#how-does-null-or-nothingness-work-in-julia में सुझाव काम नहीं करते हैं।जूलिया हैंडलिंग शून्य वापसी प्रकार
julia> isempty(Base.source_dir())
ERROR: MethodError: no method matching start(::Void)
Closest candidates are:
start(::SimpleVector) at essentials.jl:170
start(::Base.MethodList) at reflection.jl:258
start(::IntSet) at intset.jl:184
...
in isempty(::Void) at ./iterator.jl:3
in isempty(::Void) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
julia> isdefined(Base.source_dir())
ERROR: TypeError: isdefined: expected Symbol, got Void
julia> typeof(Base.source_dir()) == Void
true
यह जूलिया 0.5 पर है:
एक मेगावाट (आरईपीएल से इतना Base.source_dir()
रिटर्न Void
चलाने जाना चाहिए)। उत्तरार्द्ध विकल्प काम करता है, लेकिन यह थोड़ा बदसूरत है।
'===' आमतौर पर अनुशंसित किया जाता है, क्योंकि अजीब तरीकों से '==' का विस्तार करना संभव है। –