One issue that crops up occasionally is if there is some way we could make typically Erlang atoms/names look more lispy. Why can't we write multiple-word-atoms instead of the Erlang camel_case or the even more horrendous OO inspired camelCase? Can't the parser/printer fix this for us?
Well yes, it could and it actually isn't that difficult. We fix the parser/printer so a '-' in an LFE atom becomes '_' in the Erlang and vice-versa. So we write/see in LFE handle-info <==> handle_info in Erlang. Easy. What if we actually *want* a '-' in the atom? Again easy, we just prefix it with a '\' we get handle\-info <==> 'handle-info' which is again pretty straight-forward and (almost) understandable. But now it starts getting difficult. What if we actually want to see '_'in the LFE atom? Well as it stands if we just write it in the LFE atom it will also end up in the Erlang atom but when it is printed we see the '-' instead so:
> 'with_underscore
with-underscore
which is not too good. We could always just flip them so '-'<==> '_' but that would be really confusing.
And the solution breaks the WYSIWYG. Hence we don't do anything and put up with it as it is.
Of course we can always write our LFE code so the names are nice and lispy.
I have a plan to rename all the LFE modules with their functions and constants to have lispy names.
This will help a bit. The only thing we can't do is have a '-' in an application name, it just doesn't work.
--
Robert
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at https://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.
I have a plan to rename all the LFE modules with their functions and constants to have lispy names.Yay! I've been wanting that from the very first day I started using LFE. Is this going in LFE 1.0??? :-)))
One issue that crops up occasionally is if there is some way we could make typically Erlang atoms/names look more lispy. Why can't we write multiple-word-atoms instead of the Erlang camel_case or the even more horrendous OO inspired camelCase? Can't the parser/printer fix this for us?
Well yes, it could and it actually isn't that difficult. We fix the parser/printer so a '-' in an LFE atom becomes '_' in the Erlang and vice-versa. So we write/see in LFE handle-info <==> handle_info in Erlang. Easy. What if we actually *want* a '-' in the atom? Again easy, we just prefix it with a '\' we get handle\-info <==> 'handle-info' which is again pretty straight-forward and (almost) understandable. But now it starts getting difficult. What if we actually want to see '_'in the LFE atom? Well as it stands if we just write it in the LFE atom it will also end up in the Erlang atom but when it is printed we see the '-' instead so:
> 'with_underscore
with-underscore
which is not too good. We could always just flip them so '-'<==> '_' but that would be really confusing.
And the solution breaks the WYSIWYG. Hence we don't do anything and put up with it as it is.
Of course we can always write our LFE code so the names are nice and lispy. I have a plan to rename all the LFE modules with their functions and constants to have lispy names. This will help a bit. The only thing we can't do is have a '-' in an application name, it just doesn't work.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
(import (prefix mod mod-prefix)) - NYI
Regards,
(alias mod mod-prefix)
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at https://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
Robert
Sorry, I still don't quite get what you mean. Could you explicitly show me how the LFE atom and erlang would look?Robert
atoms_rule`, which in LFE becomes `atoms-rule`, nice and lispy. And in LFE `atoms-rule` would translate back to `atoms_rule`. But if you need a `_` in the LFE atom, e.g. `erlangy_atom`, we can't just translate that to Erlang as is, b/c it would come back to LFE as `erlangy-atom`. So instead `erlangy_atom` can translate to Erlang as `erlangy__atom`, and LFE can see the two underscores and know to translate it back to LFE as just one.