04-08-2016, 02:26 PM
Hi!dgud,Cause was found.
(The past few week I was talking with him about the problem of wpc_hlines module on github.)
It was due to that contained complex anonymous function within the tuple on function binding( Line: around 486).
I can't understanded how an error occurs in what mechanism.
The sequence of events:
I also decided to examine the problem by using a dialyzer too.
And,Dialyzer has outputted to the same error message.
So, I have read carefully the source.
Note: It is might be a misguided reasoning, because I'm not a programming expert.
Look at a Line around 486 from wpc_hlines.erl
Note:The binded variable Proj( = defined by fun() an anonymous function in the tuple ) is replaced as follows
proj({X, Y, Z}) -> %some process% end;
proj({{X1, Y1, Z1}, {X2, Y2, Z2}}) -> %some process% end.
The error massage of an argument type "LVCt::{{float(),float()} | {_,_,_},{float(),float()} | {_,_,_}})"
In fact,LVCt took the two tuples or three tuples.
*LVCt* = {{0.7256575605567986,-0.6635543866848802,-13.425001504083214},
{1.3669827324774597,-0.014517512922733067,-15.204735518018442}}
Probably this means that the argument must be pass into Proj() originally.
But Dialyzer suggests the possibility of it pass into persp_sf/1 (with incorrect argument type)
I thought that If any exception occurred on the fun(), then data passed to function persp_sf/1.
Then,I've isolated the Proj(fun()) from the tuple.
It has changed in this way.
and using dialyzer once again.
The error message has been eliminated.
How about that?
--------
tkbd
(The past few week I was talking with him about the problem of wpc_hlines module on github.)
It was due to that contained complex anonymous function within the tuple on function binding( Line: around 486).
I can't understanded how an error occurs in what mechanism.
The sequence of events:
I also decided to examine the problem by using a dialyzer too.
And,Dialyzer has outputted to the same error message.
Quote: Checking whether the PLT /Users/*****/.dialyzer_plt is up-to-date... yes
Proceeding with analysis...
wpc_hlines.erl:771: The call wpc_hlines:persp_sf(LVCt::{{float(),float()} | {_,_,_},{float(),float()} | {_,_,_}}) will never return since it differs in the 1st argument from the success typing arguments: ({_,number()})
~omit ~
done in 0m4.21s
done (warnings were emitted)
So, I have read carefully the source.
Note: It is might be a misguided reasoning, because I'm not a programming expert.
Look at a Line around 486 from wpc_hlines.erl
Code:
{Proj, Front_face, Side_face, Wvp, Hvp} =
if
Is_ortho ->
{fun({X, Y, _Z}) -> {X, Y}; %% This fun() is binded to Proj
({{X1, Y1, _Z1}, {X2, Y2, _Z2}}) ->
{{X1, Y1}, {X2, Y2}}
end,
fun ortho_ff/1,
fun ortho_sf/1,
Distance * ARw / Flen,
Distance * ARh / Flen}
;
true ->
{fun({X, Y, Z}) -> %% This fun() is binded to Proj
Rz = case catch Zf / Z of
R when is_float(R) -> R; _ -> ?BIG end,
{X * Rz, Y * Rz};
({{X1, Y1, Z1}, {X2, Y2, Z2}}) ->
Rz_1 = case catch Zf / Z1 of
R1 when is_float(R1) -> R1; _ -> ?BIG end,
Rz_2 = case catch Zf / Z2 of
R2 when is_float(R2) -> R2; _ -> ?BIG end,
{{X1 * Rz_1, Y1 * Rz_1}, {X2 * Rz_2, Y2 * Rz_2}}
end,
fun persp_ff/1,
fun persp_sf/1, %% binded to Side_face
ARw,
ARh}
end,
Note:The binded variable Proj( = defined by fun() an anonymous function in the tuple ) is replaced as follows
proj({X, Y, Z}) -> %some process% end;
proj({{X1, Y1, Z1}, {X2, Y2, Z2}}) -> %some process% end.
The error massage of an argument type "LVCt::{{float(),float()} | {_,_,_},{float(),float()} | {_,_,_}})"
In fact,LVCt took the two tuples or three tuples.
*LVCt* = {{0.7256575605567986,-0.6635543866848802,-13.425001504083214},
{1.3669827324774597,-0.014517512922733067,-15.204735518018442}}
Probably this means that the argument must be pass into Proj() originally.
But Dialyzer suggests the possibility of it pass into persp_sf/1 (with incorrect argument type)
I thought that If any exception occurred on the fun(), then data passed to function persp_sf/1.
Then,I've isolated the Proj(fun()) from the tuple.
It has changed in this way.
Code:
Proj =
if
Is_ortho ->
fun({X, Y, _Z}) -> {X, Y};
({{X1, Y1, _Z1}, {X2, Y2, _Z2}}) ->
{{X1, Y1}, {X2, Y2}}
end
;
true ->
fun({X, Y, Z}) ->
Rz = case catch Zf / Z of
R when is_float(R) -> R; _ -> ?BIG end,
{X * Rz, Y * Rz};
({{X1, Y1, Z1}, {X2, Y2, Z2}}) ->
Rz_1 = case catch Zf / Z1 of
R1 when is_float(R1) -> R1; _ -> ?BIG end,
Rz_2 = case catch Zf / Z2 of
R2 when is_float(R2) -> R2; _ -> ?BIG end,
{{X1 * Rz_1, Y1 * Rz_1}, {X2 * Rz_2, Y2 * Rz_2}}
end
end,
{Front_face, Side_face, Wvp, Hvp} =
if
Is_ortho ->
{fun ortho_ff/1,
fun ortho_sf/1,
Distance * ARw / Flen,
Distance * ARh / Flen}
;
true ->
{ fun persp_ff/1,
fun persp_sf/1,
ARw,
ARh}
end,
and using dialyzer once again.
Quote:$ dialyzer /Applications/Wings3D\ 2.0.2.app/Contents/Resources/lib/wings-2.0.2/plugins/import_export/wpc_hlines.beam
Checking whether the PLT /Users/*****/.dialyzer_plt is up-to-date... yes
Proceeding with analysis...
~omit ~
done in 0m4.83s
done (passed successfully)
The error message has been eliminated.
How about that?
--------
tkbd