<div>
The record will be initialised with the defaults as specified in the hrl. The code and stacktrace in the gist still suggest that SpecCon#constraint.morphology is ‘undefined’ - so something between the record construction below and the crash within the gist must be modifying the record.
</div>
<div><div><br></div><div>-- </div><div>Steve Strong</div><div>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div>
<p style="color: #A0A0A8;">On Sunday, 17 August 2014 at 15:36, Yves S. Garret wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><div dir="ltr"><div>The record in question is "constraint". The thing is, when I call it, it looks like this with none of the values initialized:<br><br>test() -><br> Specie_Id = test,<br> Agent_Id = test,<br>
CloneAgent_Id = test_clone,<br> SpecCon = #constraint{}, % <---- HERE IS WHERE THE FIRST INSTANCE IS CREATED<br> F = fun() -><br> construct_Agent(Specie_Id, Agent_Id, SpecCon),<br> clone_Agent(Specie_Id, CloneAgent_Id),<br>
print(Agent_Id),<br> print(CloneAgent_Id),<br> delete_Agent(Agent_Id),<br> delete_Agent(CloneAgent_Id)<br> end,<br><br> mnesia:transaction(F).<br><br></div>My question is thus, if I make a record with #constraint{}, does that mean that all of its values are by default set to undefined or the default values that were specified in records.hrl?<br>
<br><div><br></div></div><div><br><br><div>On Sat, Aug 16, 2014 at 2:35 AM, Steve Strong <span dir="ltr"><<a href="mailto:steve@srstrong.com" target="_blank">steve@srstrong.com</a>></span> wrote:<br><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I'm guessing that this:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px;width:748px"><div><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>Morphology</span> <span style="font-weight:bold">=</span> <span>SpecCon</span><span>#constraint.morphology</span><span>,</span></span></font></div>
</pre><div><br></div>Is setting Morphology to 'undefined' - that's what the stack trace looks to be saying.</div><div><br></div><div>Cheers,</div><div><br></div><div>Steve</div><div><br><span>Sent from my iPhone</span></div>
<div><div><div><br>On 16 Aug 2014, at 04:54, "Yves S. Garret" <<a href="mailto:yoursurrogategod@gmail.com" target="_blank">yoursurrogategod@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div>
<div><div dir="ltr"><div>Hello,<br><br></div>This is my code:<br><a href="https://gist.github.com/anonymous/5b9b2c55a7684f5386e2" target="_blank">https://gist.github.com/anonymous/5b9b2c55a7684f5386e2</a><br><div><br>When I run my code inside of erlang (17.0), this is the error that I get:<br>
7> genotype:create_test().<br>{aborted,{undef,[{morphology,undefined,[sensors],[]},<br> {morphology,get_InitSensors,1,<br> [{file,"morphology.erl"},{line,8}]},<br>
{genotype,construct_Cortex,3,<br>
[{file,"genotype.erl"},{line,41}]},<br> {genotype,construct_Agent,3,<br> [{file,"genotype.erl"},{line,20}]},<br> {genotype,'-create_test/0-fun-0-',0,<br>
[{file,"genotype.erl"},{line,434}]},<br> {mnesia_tm,apply_fun,3,[{file,"mnesia_tm.erl"},{line,833}]},<br> {mnesia_tm,execute_transaction,5,<br>
[{file,"mnesia_tm.erl"},{line,813}]},<br> {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,661}]}]}}<br><br></div><div>genotype.erl and morphology.erl are in the directory, so why can't genotype's function call morphology's functions? Or am I missing something else entirely?<br>
<br></div><div>Thanks.<br></div></div>
</div></div></blockquote></div></div><blockquote type="cite"><div><span>_______________________________________________</span><div><br><span>erlang-questions mailing list</span><br><span><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a></span><br>
<span><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br></div></div></blockquote></div></blockquote></div><br></div>
</div></div></span>
</blockquote>
<div>
<br>
</div>