inaka / aleppo

Alternative Erlang Pre-Processor
MIT License
7 stars 5 forks source link

maps's error not throw #9

Closed dcy closed 9 years ago

dcy commented 9 years ago

I don't know it is ChicagoBoss'e bug, or aleppo. I use this aleppo branche, it also not throw maps's error If Account is maps. And "Account:id()" not throw any error. It should be: exception error: bad argument in function apply/3 called as apply(#{key => value},id,[]) No error and i can't debug my code.

jfacorro commented 9 years ago

If I understand your problem correctly, the variable Account has a map as its value and the code is trying to make a dynamic call as in Account:id(). If this is the case, then it is a runtime error.

Aleppo is a pre-processor that only handles the pre-processing constructs in the Erlang language, which means it doesn't have access to runtime information, therefore it can't detect this kind of errors.

If I misunderstood your problem please let me know. Thanks!

dcy commented 9 years ago

I can't debug or i can't find my maps' error easily because it can't throw this kind of errors. I remove boss_db in my application, so the code like "Accound:id()" should change to "maps:get(id, Account). There is no boss_db objects, all change to maps. Is there other convenient method for me to refactor my code?

jfacorro commented 9 years ago

I'm not familiar with ChicagoBoss or BossDB, so I'm not sure if I can help. For refactoring you can always use grep to look for the expression Account:id() and then replace the occurrences for maps:get(id, Account). I'm closing this issue since it is not related to aleppo. Cheers!