User Tools

Site Tools


notes_while_learning_elixir

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
notes_while_learning_elixir [2018/08/12 17:57]
luciano [import]
notes_while_learning_elixir [2018/08/12 18:00]
luciano [import]
Line 19: Line 19:
  
  
-  * The comma after the ''​MyModule''​. It's there because ''​import''​ is a macro, and ''​only:​ […]''​ is the second argument (more about that below). Maybe I'll accept ​it or (get used to it) when I learn to code macros. For a beginner, that comma is just strange.+  * The comma after the ''​MyModule''​. It's there because ''​import''​ is a macro, and ''​only:​ […]''​ is the second argument (more about that below). Maybe I'll accept ​that comma or (get used to it) when I learn to code macros. For a beginner, that comma is just strange.
  
   * The colon after ''​only''​. That's because the second argument is actually a keyword list (or whatever it's called, I'm not sure about the name of that now). The full syntax would be ''​{:​only,​ x}'',​ but there'​s this syntactic sugar that allows spelling such lists without the braces and comma, when they appear as the trailing arguments in a function or macro call.   * The colon after ''​only''​. That's because the second argument is actually a keyword list (or whatever it's called, I'm not sure about the name of that now). The full syntax would be ''​{:​only,​ x}'',​ but there'​s this syntactic sugar that allows spelling such lists without the braces and comma, when they appear as the trailing arguments in a function or macro call.
  
-  * The list ''​[MyFunc:​ 1]''​ to specify a function with arity 1. Why not ''​MyFunc/​1'',​ the syntax used by the capture operator ''&''?​+  * The list ''​[MyFunc:​ 1]''​ to specify a function with arity 1. Why not ''​MyFunc/​1'',​ the syntax used by the capture operator ''&''? ​(I don't like that syntax either, but I'd rather see ugly syntax used consistently than inconsistent,​ ugly syntax to represent the same concept: fn_name/​arity)
  
    
notes_while_learning_elixir.txt · Last modified: 2018/08/12 18:01 by luciano