kerryb
WxEx – Elixir wrappers for macros and records in :wx
I’m not sure how many people are using wxWidgets in Elixir, but in the course of playing around with it I created a small library to expose the Erlang macros and record definitions to Erlang code.
It doesn’t wrap any of the :wx modules, because they can be used directly from Elixir.
I haven’t actually used it in any real projects yet, so if you find anything wrong or missing, feel free to raise an issue.
Thanks to @harrisi for managing to find it before I’d shown it to anyone, and submitting a PR to add OpenGL constants!
Most Liked
cmo
I tend to think it should be kept the same because a) is easier to write the code (I have a similar script that allows access to the wx Erlang constants) and b) searching the WxWidget docs is easier when the names are the same.
@kerryb what’s the point of the WxObject wrapper if everything else apart from the constants is Erlang syntax?
christhekeele
kerryb
In my opinion you should follow
Elixir’s naming convention, so all of themacrosandfunctionsshould be snake case.
The main reason I didn’t do that was … well, laziness to be honest, but also I’ve used tools before (eg Java and Ruby bridges to Apple’s Cocoa) where having to keep mentally translating the names of things when reading documentation was confusing.
I understand that it’s for a reason, so instead of converting it to snake case I would rather fit it in
Elixir’s standards, for example a call like:wxALIGN_RIGHT()could be changed to:
wx(:ALIGN_RIGHT)
I do like that idea – it seems nicer than polluting the namespace by importing hundreds of functions into a module.
Maybe you could use more clear example usage here.
Yes, good point – I just pasted some snippets from a code sample I’d converted, assuming that if anyone was interested they’d already be far more familiar with wx than I am. I ought to replace it with a working “hello world” example.
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










