Well on further reflection my implementation id isn't gonna work easily.
The basic idea with Ets specifically was to have a struct that included the
various options used and to use that info to return better error messages
in the event an error was raised. My thought was that that would only be
done on error, so that it didn't incur much overhead in the happy path.
This fails with just passing in a name though obviously so that won't work.
Possibly there's some :ets debugging functions that could be used, I'll
look into it more if there's interest.
Crypto is easier. We know that keys have to be a certain byte width for
example, so we just bake those checks into the elixir side and call out to
`:crypto` if it's ok, otherwise return a useful error message.
Thoughts?
- Ben
On Thursday, May 26, 2016 at 7:49:31 AM UTC-4, Ben Wilson wrote:
>
> I hit post too early, please hold...
>
> On Thursday, May 26, 2016 at 7:49:20 AM UTC-4, Ben Wilson wrote:
>>
>> Hey folks!
>>
>> I was prompted down this mode of thinking after answering some questions
>> related to why `:ets` was returning argument error. Turns out they hadn't
>> included the `[:named_table]` option. However the error message gave them
>> exactly zero help when it comes to figuring out what is wrong.
>>
>> `:crypto` is another good example where any number of things can go
>> wrong, and all will result in the same generic argument error.
>>
>> There's really two questions here:
>>
>> 1) Is it worth wrapping something like :ets or :crypto with an elixir
>> module that could improve error messages?
>>
>> 2) Does this particular implementation idea I have sound reasonable?
>>
>> I split it up this way of course because while #2 may be a bad idea, I
>> don't want rejection of #2 to imply rejection of #1.
>>
>>
>> ## Implementation notion.
>>
>> By way of example, let's tackle that :ets problem
>>
>> Ets.new returns %Ets{opts: [:named_table], ets_id: 123987}
>>
>> defmodule Ets do
>>
>> end
>>
>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/00a26074-1e7a-495d-a454-da61b187e12e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.