Skip to content

esip_codec:encode_via not check member value =:= undefined #3

Description

@wanglihe

For example, if host =:= undefined, it just encode record with some atom undefined, the encode returns ok, and it's result can not transfer to binary or send with udp port. I think it should return error, or just encode "undefined" to some string but not an atom.

Activity

  1. zinid commented on May 13, 2016

    @zinid
    Contributor

    Well, in that case we need to add checks in many places of encoding functions. I don't think we need this burden really. For example, in the same encode_via we should check Proto, Transport etc have correct values.

  2. wanglihe commented on May 14, 2016

    @wanglihe
    Author

    I agree with you that it is difficult to check every mistake, but that is codecs should do. Every mistake create by compilers will make bugs far far away and debug is very difficult, I have just spent about 3 hours to catch one, it is dangerous. Maybe it is not the good time to fix it right now, but it should be fixed as soon as possible.

  3. zinid commented on May 14, 2016

    @zinid
    Contributor

    Then you probably chose a wrong language. That's a common problem of duck typing. When you put wrong values to some built-in OTP functions you will get pretty cryptic errors as well. Also, the error you're talking about is not that cryptic, typically you will get badarg which is pretty easy to understand.

  4. wanglihe commented on May 14, 2016

    @wanglihe
    Author

    Erlang says: crash as soon as possible. I am not choose wrong, and this is not a problem of duck typing. OTP try to throw exceptions everywhere, debug is easy. BTW, is Erlang's type system duck typing? I thought duck typing is something about OO, not functional languages. Maybe I was wrong. This issue is only a suggestion, try to make esip better and easier to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions