<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="63443" data-post-id="63443">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ShalokShalom" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ShalokShalom/120/15829_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ShalokShalom
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="62" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>F# lacks higher modules</p>
</blockquote>
</aside>
<p>I am still interested about the real world usage of those and how we can write code with it, that is unavoidable easier to read and write as in F-Sharp.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="62" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>it is slower due to compiling to virtual-filled .NET</p>
</blockquote>
</aside>
<p>There is .NET Native in the making.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://learn.microsoft.com/en-us/dotnet/framework/net-native/net-native-and-compilation">
  <header class="source">

      <a href="https://learn.microsoft.com/en-us/dotnet/framework/net-native/net-native-and-compilation" target="_blank" rel="noopener nofollow ugc">learn.microsoft.com</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/362;"><img src="https://learn.microsoft.com/en-us/media/open-graph-image.png" class="thumbnail" alt="" width="690" height="362"></div>

<h3><a href="https://learn.microsoft.com/en-us/dotnet/framework/net-native/net-native-and-compilation" target="_blank" rel="noopener nofollow ugc">.NET Native and Compilation - UWP applications</a></h3>

  <p>Compare the compiling method for .NET Native with Just-In-Time (JIT) and other compilation technologies available for .NET Framework apps and why exceptions my occur.</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>Secondly, there is less significant performance difference, IMHO. Sure, OCaml is speedy like C, while .NET is speedy like Java and thats more than enough for most use cases, yes?</p>
<p>You use Python in your job like millions others do.<br>
And that one is markable slower as F-Sharp. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="62" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Hmm, I’ve not run across that, that’d be interesting to look at.  Links?  As far as I know it can ‘consume’ simple (non-module’y) OCaml code, but not produce it?</p>
</blockquote>
</aside>
<aside class="onebox pdf" data-onebox-src="https://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-latest.pdf">
  <header class="source">

      <a href="https://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-latest.pdf" target="_blank" rel="noopener nofollow ugc">fsharp.org</a>
  </header>

  <article class="onebox-body">
    <a href="https://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-latest.pdf" target="_blank" rel="noopener nofollow ugc"><span class="pdf-onebox-logo"></span></a>

<h3><a href="https://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-latest.pdf" target="_blank" rel="noopener nofollow ugc">FSharpSpec-4.0-latest.pdf</a></h3>

  <p class="filesize">3.64 MB</p>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<aside class="quote no-group" data-username="OvermindDL1" data-post="62" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Yeah, a lot of it’s syntax is making it have larger syntax actually, with no greater benefit in readability in my opinion (though perhaps to JS users…).</p>
</blockquote>
</aside>
<p>Well, not in terms of readability for coders who are used to the OCaml syntax.</p>
<p>While this Reason comparison page to OCaml shows clearly that there are some inconsistencies, who floated into the language over time. <a href="https://reasonml.github.io/guide/ocaml/#tuples-as-type-parameters" class="inline-onebox" rel="noopener nofollow ugc">Reason · Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript &amp; OCaml ecosystems.</a></p>
<p>Such things can confuse a newbie significantly.</p>
<p>Again, the F-Sharp syntax is here the happy medium in my terms.</p>
<p>And its possible to use begin/end same as in OCaml, you dont have to use indendation for local scope.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="63443" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/63">Post #62</a>
	                </div>
	            </div>
              <div id="likers-container-63443" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="63443"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #62"></div>
  </section>
</div>
    <div class="postbit" id="64064" data-post-id="64064">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="ShalokShalom" data-post="63" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>I am still interested about the real world usage of those and how we can write code with it, that is unavoidable easier to read and write as in F-Sharp.</p>
</blockquote>
</aside>
<p>Probably the most simple example would be something like:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">module StringMap = Map.Make(String)
</code></pre>
<p>That creates a new module of the form of Map specialized for String, and this barely scratches the surface of what it does, but this alone removes all virtual dispatch on these calls, unlike a Map on the .NET VM, and you can do the above for any type anywhere:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">type my_type = { blah : integer }
module MyTypeMap = Map.Make(struct
    type t = my_type
    let compare {blah=blah0} {blah=blah1} = compare blah0 blah1
end)
</code></pre>
<p>You just need to define the type it uses and an appropriate compare function (The String module already has both, hence why you can just pass it in straight, as would many user types be designed the same way as well).</p>
<p>And this specialization does not just link pointers and a function like F#/.NET/Java do, it literally generates a new module specialized for this specific type, no virtual calls, everything inlineable, more akin to a C++ Template than a Java/.NET Generic.</p>
<p>And even this is still minor compared to what else higher typed modules can do, you can create a whole program in the higher typed modules that reify’s down to a single type of your answer at compile-time, with relative ease.</p>
<p>And this does not even remotely touch on other features OCaml has that F# does not, like ppx_stage, or just any ppx’s at all!</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="63" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>There is .NET Native in the making.</p>
</blockquote>
</aside>
<p>Entirely unrelated.  Virtual calls is not a JIT thing that can be removed at native (in fact JIT can often optimize virtual calls better than native, about one of the only things JIT does better I think…), but rather it is when you call a function that you do no know where it is pointing to at runtime, like this pseudo-code:</p>
<pre data-code-wrap="cpp"><code class="lang-cpp">class Blah {
  public virtual string bloop() { return "base"; }
}
class BlahChild0 {
  public virtual string bloop() { return "child0; }
}
class BlahChild1 {
  public virtual string bloop() { return "child1"; }
}

Blah blah = getBlah();
blah.bloop()
</code></pre>
<p>(Wow this forum still has bad color coding…)<br>
It doesn’t matter what language you use, if <code>getBlah()</code> is not local, you don’t know which <code>bloop</code> you will be calling, it is a virtual (or indirect) function call via a mapping on the class object (which is often <strong>2</strong> pointer lookups to acquire as well!).  This is the only form of modules that F# has.  OCaml on the other hand can specialize entire code paths to specific modules, specialized for each type at each call path via first-class modules.  And this is still only scratching the capabilities.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="63" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Secondly, there is less significant performance difference, IMHO. Sure, OCaml is speedy like C, while .NET is speedy like Java and thats more than enough for most use cases, yes?</p>
</blockquote>
</aside>
<p>The speed of all is fine in execution, however OCaml <em>compiles</em> significantly faster than all that you mentioned, which makes programming and testing in it significantly faster.  So you get both fast compilation <em>and</em> fast execution.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="63" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p><a href="http://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-latest.pdf" rel="noopener nofollow ugc">http://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-latest.pdf</a></p>
</blockquote>
</aside>
<p>Yeah F# entirely lacks OCaml’s advanced module system and PPX style support, that is pretty poor…</p>
<aside class="quote no-group quote-modified" data-username="ShalokShalom" data-post="63" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>While this Reason comparison page to OCaml shows clearly that there are some inconsistencies, who floated into the language over time. <a href="https://reasonml.github.io/guide/ocaml/#tuples-as-type-parameters" class="inline-onebox" rel="noopener nofollow ugc">Reason · Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript &amp; OCaml ecosystems.</a></p>
</blockquote>
</aside>
<p>I’m not sure what you mean about tuple types?  <code>*</code> is the standard tuple type definition in quite a large variety of languages since the tuple is the base-most <code>prod</code> type, hence you use the <code>prod</code> operator.  I’m not sure what is being referenced?</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="63" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>And its possible to use begin/end same as in OCaml, you dont have to use indendation for local scope.</p>
</blockquote>
</aside>
<p>Indentation-based languages need to die off in my opinion, they are extremely brittle in long-term upkeep, Python especially…  ^.^;</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="64064" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/64">Post #63</a>
	                </div>
	            </div>
              <div id="likers-container-64064" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="64064"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #63"></div>
  </section>
</div>
    <div class="postbit" id="64508" data-post-id="64508">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ShalokShalom" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ShalokShalom/120/15829_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ShalokShalom
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Probably the most simple example would be something like:</p>
</blockquote>
</aside>
<pre><code>module StringMap = Map.Make(String)
</code></pre>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>That creates a new module of the form of Map specialized for String, and this barely scratches the surface of what it does, but this alone removes all virtual dispatch on these calls, unlike a Map on the .NET VM, and you can do the above for any type anywhere:</p>
</blockquote>
</aside>
<pre><code>type my_type = { blah : integer }
module MyTypeMap = Map.Make(struct
    type t = my_type
    let compare {blah=blah0} {blah=blah1} = compare blah0 blah1
end)
</code></pre>
<p>[quote=“OvermindDL1, post:64, topic:3693”]<br>
You just need to define the type it uses and an appropriate compare function (The String module already has both, hence why you can just pass it in straight, as would many user types be designed the same way as well).[/quote]</p>
<p>Thanks a lot <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>And this specialization does not just link pointers and a function like F#/.NET/Java do, it literally generates a new module specialized for this specific type, no virtual calls, everything inlineable, more akin to a C++ Template than a Java/.NET Generic.</p>
<p>And even this is still minor compared to what else higher typed modules can do, you can create a whole program in the higher typed modules that reify’s down to a single type of your answer at compile-time, with relative ease.</p>
</blockquote>
</aside>
<p>OK, thanks a lot again. How is that with this extension:<br>
<a href="https://github.com/gusty/FSharpPlus/blob/master/README.md" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/gusty/FSharpPlus/blob/master/README.md</a></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Entirely unrelated.  Virtual calls is not a JIT thing that can be removed at native (in fact JIT can often optimize virtual calls better than native, about one of the only things JIT does better I think…)</p>
</blockquote>
</aside>
<p>Oh, interesting. So I think the OCaml compiler is more suitable for native compilation anyway, since much more supported, capable to do “let-it-crash” and more speedy.</p>
<p>There is no reason for .NET Native anymore which I can see now.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>(Wow this forum still has bad color coding…)</p>
</blockquote>
</aside>
<p>Here it works different as for you.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>The speed of all is fine in execution, however OCaml compiles significantly faster than all that you mentioned</p>
</blockquote>
</aside>
<p>The compilation time of F-Sharp is very speedy?<br>
How ever, the REPL is speedy as in OCaml.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Yeah F# entirely lacks OCaml’s advanced module system and PPX style support, that is pretty poor…</p>
</blockquote>
</aside>
<p>So this advanced module system is related to ppx?<br>
I hope I can one time write such ppx extensions, in order to bring F-Sharps syntax to OCaml.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>I’m not sure what you mean about tuple types?</p>
</blockquote>
</aside>
<p>All these comparisons from <a href="https://reasonml.github.io/docs/en/comparison-to-ocaml.html#tuples-as-type-parameters" rel="noopener nofollow ugc">here on</a> downwards show me, that OCaml is significantly cluttered, compared to Reason in those aspects.</p>
<p>Also other differences, like <a href="https://reasonml.github.io/docs/en/comparison-to-ocaml.html#local-scope-vs-module-body" rel="noopener nofollow ugc">this one</a> show me that Reason has cleaned up OCamls syntax significantly.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="64" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Indentation-based languages need to die off in my opinion, they are extremely brittle in long-term upkeep, Python especially…  ^.^;</p>
</blockquote>
</aside>
<p>Well, this is obviously subjective.</p>
<p>To me, indentation is something that any language is sensitive about.<br>
The question is: At commit-time only, so when others are reading it, or also for the syntax checker.</p>
<p>Indendation is there anyhow, so why add additional syntax for something that can solved by it?</p>
<p>Every single piece of unneccessary bloat can go, I get very easly distracted by that.<br>
Especially for newcomers is a a no-go, to add superflous clutter into the syntax, imho.</p>
<p>Of course, there are humans like you, for who the opposite is counting, so I hope for a light&gt;&lt;verbose converter in fsharp, in order to please everyone.</p>
<p>By the way: F-Sharp allows more freedom in indendation as Python does.<br>
So you can choose the level of indendation by yourself.</p>
<p>About Python:</p>
<p>Imperative languages become brittle at all, curly brackets all over the place or not.<br>
Imperative programming is brittle by its nature, IMHO.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="64508" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/65">Post #64</a>
	                </div>
	            </div>
              <div id="likers-container-64508" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="64508"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #64"></div>
  </section>
</div>
    <div class="postbit" id="64723" data-post-id="64723">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>OK, thanks a lot again. How is that with this extension:</p>
</blockquote>
</aside>
<p>As far as I can glean from that, that requires quite a lot of indirect calls and virtual ‘classes’ (in the .NET sense).</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Oh, interesting. So I think the OCaml compiler is more suitable for native compilation anyway, since much more supported, capable to do “let-it-crash” and more speedy.</p>
</blockquote>
</aside>
<p>The OCaml compiler has pluggable back-ends.  It comes pre-built with backends for native and a specialized bytecode (great for debugging), but there are others such as to javascript, C, etc… etc…</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>There is no reason for .NET Native anymore which I can see now.</p>
</blockquote>
</aside>
<p>Many platforms you absolutely, categorically, cannot have a JIT, other than the obvious of iOS that includes systems that have read-only executable memory (a <em>lot</em> of embedded systems).  Plus you get the speed boost of initial loading time being a lot faster.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>So this advanced module system is related to ppx?</p>
</blockquote>
</aside>
<p>Two different features, unrelated, just two different features that F# lacks that I use both quite heavily.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>All these comparisons from here on downwards show me, that OCaml is significantly cluttered, compared to Reason in those aspects.</p>
</blockquote>
</aside>
<p>Cluttered how so?  First of all those examples are massively cherry-picked and do not represent real-world code (which if you read through the github issues in full you will find endless examples of how ReasonML has an explosion of parenthesis that people find really difficult to read as just one of many examples, in addition to ambiguities in syntax and more).  OCaml’s is entirely unambiguous in every context.  You always know when something is a list or a tuple or even an integer or some passed-through type.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Also other differences, like this one show me that Reason has cleaned up OCamls syntax significantly.</p>
</blockquote>
</aside>
<p>I’m not really seeing where.  First of all the examples with <code>;;</code> at the end of the line is entirely stupid (<code>;;</code> is a marker to the repl to ‘run all code entered up till now, right now’, it has no meaning in source code).  Second of all, the ‘imperative’ examples is entirely unidiomatic OCaml as imperative code is often entirely not used, and even when used you would <em>NOT</em> want to hide it by not confirming it’s return type (the <code>let () = ...</code> part) as in doing that if you change the return type of the function then you are suddenly not handling it everywhere and can easily miss places that need to handle it now (where the idiomatic ReasonML just kind of silently ignores the change).  In many examples they use parenthesis where they are not needed sometimes, and don’t use it other times, they are very inconsistent.  Also the heck about the function example, who would ever write ocaml function definitions as anything but the first one?!  Also in the ReasonML one what if you have a function that takes a tuple, well now you have multiple embedded parenthesis (this is a common pattern in many cases where you are enforcing uncurrying, doing this in Reason involves lots of double parenthesis instead).  Again, it is all mis-informed and cherry picked to make ReasonML look better than it actually is.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Well, this is obviously subjective.</p>
</blockquote>
</aside>
<p>I don’t think so, making code indentation sensitive (ala Python or Haskell) means you cannot easy copy/paste code, instead you have to reformat/reindent it into the area it is being pasted in, where with indentation-insensitive languages you can just paste it and run the formatter over it when you save as normal (ocp-indent for OCaml).</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Every single piece of unneccessary bloat can go, I get very easly distracted by that.<br>
Especially for newcomers is a a no-go, to add superflous clutter into the syntax, imho.</p>
</blockquote>
</aside>
<p>Yeah definitely agree there, like ReasonML is full of such bloat, though not as much as Elixir, Elixir’s syntax is <em>very</em> noisy…  ^.^;</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Imperative languages become brittle at all, curly brackets all over the place or not.<br>
Imperative programming is brittle by its nature, IMHO.</p>
</blockquote>
</aside>
<p>Curly brackets have nothing to do with imperative anything.  Languages that use curly brackets as Scope just use that as such, there are many forms, imperative or not.  I prefer how OCaml does scope as 99% of the time it’s only a single expression deep, so absolutely nothing is needed, and the rest of the time you can choose between whichever makes more sense of parenthesis or <code>begin</code>/<code>end</code>.  But yes, imperative languages do tend to naturally be brittle in a variety of ways.  ^.^;</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="64723" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/66">Post #65</a>
	                </div>
	            </div>
              <div id="likers-container-64723" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="64723"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #65"></div>
  </section>
</div>
    <div class="postbit" id="65694" data-post-id="65694">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ShalokShalom" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ShalokShalom/120/15829_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ShalokShalom
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>The OCaml compiler has pluggable back-ends.  It comes pre-built with backends for native and a specialized bytecode (great for debugging), but there are others such as to javascript, C, etc… etc…</p>
</blockquote>
</aside>
<p>So I can produce C code with it?</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Many platforms you absolutely, categorically, cannot have a JIT, other than the obvious of iOS that includes systems that have read-only executable memory (a lot of embedded systems).  Plus you get the speed boost of initial loading time being a lot faster.</p>
</blockquote>
</aside>
<p>I mean compared to the OCaml one instead.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Two different features, unrelated, just two different features that F# lacks that I use both quite heavily.</p>
</blockquote>
</aside>
<p>Therefore, F# offers you active patterns, computation expressions, type providers…</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Cluttered how so?  First of all those examples are massively cherry-picked and do not represent real-world code</p>
</blockquote>
</aside>
<p>This might be</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>if you read through the github issues in full you will find endless examples of how ReasonML has an explosion of parenthesis that people find really difficult to read</p>
</blockquote>
</aside>
<p>No doubt about that. This is the reason, why I dont use Reason. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>OCaml’s is entirely unambiguous in every context.  You always know when something is a list or a tuple or even an integer or some passed-through type.</p>
</blockquote>
</aside>
<p>Might be for you, since you are a professional?</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>the examples with ;; at the end of the line is entirely stupid (;; is a marker to the repl to ‘run all code entered up till now, right now’, it has no meaning in source code).</p>
</blockquote>
</aside>
<p>We already chewed that and yeah, I agree with you that they should take it out, I even discussed about that with Chenglou and called it an unfair comparison.</p>
<p>They decide to leave it in. Which means probably, they are scared to look unimportant without such nonsense. Which tells us a story on its own. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>While that truth is obvious, semicolons get used in order to get better information at debugging, Jane Street is using it like that and you already confirmed that sense. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group quote-modified" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Second of all, the ‘imperative’ examples is entirely unidiomatic OCaml as imperative code is often entirely not used, and even when used you would NOT want to hide it by not confirming it’s return type (the let () = … part) as in doing that if you change the return type of the function then you are suddenly not handling it everywhere and can easily miss places that need to handle it now (where the idiomatic ReasonML just kind of silently ignores the change).  In many examples they use parenthesis where they are not needed sometimes, and don’t use it other times, they are very inconsistent.  Also the heck about the function example, who would ever write ocaml function definitions as anything but the first one?!  Also in the ReasonML one what if you have a function that takes a tuple, well now you have multiple embedded parenthesis (this is a common pattern in many cases where you are enforcing uncurrying, doing this in Reason involves lots of double parenthesis instead).  Again, it is all mis-informed and cherry picked to make ReasonML look better than it actually is.</p>
</blockquote>
</aside>
<p>I got it. Thanks. This is not possible without the insight of someone experienced, so your information is gold. I can just guess otherwise or learn all this hard on my own.<br>
In that perspective, the behaviour of the Reason guys is sad, while well known in the community. Lets say they are too unexperienced in OCaml to know these things. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>I don’t think so, making code indentation sensitive (ala Python or Haskell) means you cannot easy copy/paste code, instead you have to reformat/reindent it into the area it is being pasted in, where with indentation-insensitive languages you can just paste it and run the formatter over it when you save as normal (ocp-indent for OCaml).</p>
</blockquote>
</aside>
<p>You can do that in F-Sharp too?</p>
<p><a href="https://github.com/dungpa/fantomas/" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/dungpa/fantomas/</a></p>
<p>And here is a web version: <a href="https://fantomasweb.apphb.com/" rel="noopener nofollow ugc">https://fantomasweb.apphb.com/</a></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Elixir’s syntax is very noisy…  ^.^;</p>
</blockquote>
</aside>
<p>Which is why I dont use it. While I can deal with such noisiness after a while, like in JavaScript. On point, I would say I consider Elixir one of the first choices - if not the first choice - for me when I like to type dynamicly, for which ever reason.</p>
<p>And I still prefer Elixir for Reason, for the curly brackets. Nothing can distract me more as this one, it just seems like coding in a decades old language. Oh wait…</p>
<p>Edit: I just discovered, that I can do <a href="http://tomasp.net/blog/fsharp-dynamic-lookup.aspx/" rel="noopener nofollow ugc">dynamic lookup</a> in F-Sharp ^-^</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Curly brackets have nothing to do with imperative anything.</p>
</blockquote>
</aside>
<p>I do not state this.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>I prefer how OCaml does scope as 99% of the time it’s only a single expression deep</p>
</blockquote>
</aside>
<p>Yeah, I also love that. Its what conciliates me with it. While 99% are of course overdone by you ;)[quote=“OvermindDL1, post:66, topic:3693”]<br>
and the rest of the time you can choose between whichever makes more sense of parenthesis or begin/end<br>
[/quote]</p>
<p>Yeah, I also love that, since I can choose and choice is always good. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"><br>
I love the parenthesis here, since keywords are in my head something that belongs to something completely different, while curly, bracket and common parenthesis are used all over the place to define scope. So it makes more sense to me. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="66" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>But yes, imperative languages do tend to naturally be brittle in a variety of ways.  ^.^;</p>
</blockquote>
</aside>
<p>Oh, yeah. -.-</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="65694" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/67">Post #66</a>
	                </div>
	            </div>
              <div id="likers-container-65694" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="65694"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #66"></div>
  </section>
</div>
    <div class="postbit" id="65813" data-post-id="65813">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>So I can produce C code with it?</p>
</blockquote>
</aside>
<p>It’s a large bit ugly, but yep, that’s the <code>ocamlcc</code> project, been a few years since I’ve heard of how it’s doing so it might need some updating, but it’s there and it’s easy enough.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>I mean compared to the OCaml one instead.</p>
</blockquote>
</aside>
<p>The OCaml what?  OCaml does not use a JIT, it is pre-compiled.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Therefore, F# offers you active patterns, computation expressions, type providers…</p>
</blockquote>
</aside>
<p>Active patterns are doable via PPX in OCaml (or sans ppx but slightly wordy via module functors).<br>
No clue what computation expression is.<br>
Type providers are just a crutch they added to work around the lack of first-class modules.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Might be for you, since you are a professional?</p>
</blockquote>
</aside>
<p>My current job is the only time I’ve used OCaml professionally, before that it was all just my own code.  ^.^;<br>
But that is not what I was referencing, rather the syntax is.  Like if you see:</p>
<ul>
<li><code>[ expr's ]</code> → Always a list</li>
<li><code>expr , expr</code> → Always a tuple</li>
<li><code>[| expr's |]</code> → Always an array</li>
<li><code>expr.name</code> → Always a record access</li>
<li><code>Name.name</code> → Always a module access</li>
<li><code>expr#expr</code> → Always an object access</li>
<li><code>expr;expr</code> → Always returns the second expr (same as erlang!)</li>
</ul>
<p>Etc… etc…</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>They decide to leave it in. Which means probably, they are scared to look unimportant without such nonsense. Which tells us a story on its own. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>Yeah I saw those, it rubs me the wrong way.  Comparisons should be fair and traditional code.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>I got it. Thanks. This is not possible without the insight of someone experienced, so your information is gold. I can just guess otherwise or learn all this hard on my own.<br>
In that perspective, the behaviour of the Reason guys is sad, while well known in the community. Lets say they are too unexperienced in OCaml to know these things. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>It’s built for javascripters, you know how they (very general sense) seem to like the syntax fluff, same with Ruby’ers and such.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>You can do that in F-Sharp too?</p>
</blockquote>
</aside>
<p>When not in an indentation sensitive context, otherwise it can mess up, as like in Python or Haskell.</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="67" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Edit: I just discovered, that I can do dynamic lookup in F-Sharp ^-^</p>
</blockquote>
</aside>
<p>Interesting.  The traditional dynamic lookup methods in OCaml is either to use a map of some sort, otherwise Objects are dynamically row-typed, or you can use the introspective functions to pick and peel apart any type in the system to see and access what is inside.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="65813" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/68">Post #67</a>
	                </div>
	            </div>
              <div id="likers-container-65813" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="65813"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #67"></div>
  </section>
</div>
    <div class="postbit" id="65879" data-post-id="65879">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ShalokShalom" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ShalokShalom/120/15829_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ShalokShalom
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="68" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>The OCaml what?  OCaml does not use a JIT, it is pre-compiled.</p>
</blockquote>
</aside>
<p>You might not be aware about the <a href="https://docs.microsoft.com/en-us/dotnet/framework/net-native/" rel="noopener nofollow ugc">.Net Native</a> which I mention.</p>
<p>I mean there is no reason for .NET Native anymore for me, since the native OCaml compiler provides much more. See:</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="65" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>I think the OCaml compiler is more suitable for native compilation anyway, since much more supported, capable to do “let-it-crash” and more speedy.</p>
</blockquote>
</aside>
<p>Anyway, so long as .Net Native support for Linux in the form of <a href="https://github.com/dotnet/corert" rel="noopener nofollow ugc">CoreRT</a> does happen so slow and discriminating towards F#, will I prefer OCaml for native code.</p>
<p>This is all that I am saying.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="68" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>No clue what computation expression is.</p>
</blockquote>
</aside>
<p>You can read about them <a href="https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/computation-expressions" rel="noopener nofollow ugc">here</a></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="68" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Type providers are just a crutch they added to work around the lack of first-class modules.</p>
</blockquote>
</aside>
<p>In which way?[quote=“OvermindDL1, post:68, topic:3693”]<br>
My current job is the only time I’ve used OCaml professionally<br>
[/quote]</p>
<p>With professional, I mean on a highly skilled level.[quote=“OvermindDL1, post:68, topic:3693”]<br>
Yeah I saw those, it rubs me the wrong way.  Comparisons should be fair and traditional code.<br>
[/quote]</p>
<p>Yeah, especially since such a questionable behaviour is one of the main reasons, why I spend years with the community, in order to achieve which I can now communicate within months.</p>
<p>While this is an interesting journey on its own, so I think I am thankful for this. <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="68" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>same with Ruby’ers</p>
</blockquote>
</aside>
<p>Why Ruby? I see Ruby as comparable sane, syntax wise. Of course again from the view of a newbie.</p>
<aside class="quote no-group quote-modified" data-username="OvermindDL1" data-post="68" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>When not in an indentation-sensitive context, otherwise it can mess up, as like in Python or Haskell.</p>
</blockquote>
</aside>
<p>Well, with code formatting it can. I think such an approach as in Elm would be doable.<br>
Automatic formatting, no matter what. Much better for readability and coding standards.<br>
Plus: Even if this is true and unavoidable - which is not, as shown - would I love to pay that price for a readable syntax. Again: Ocaml is not that harsh in that perspective, since it doesnt effect all the time.</p>
<aside class="quote no-group quote-modified" data-username="OvermindDL1" data-post="68" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Interesting.  The traditional dynamic lookup methods in OCaml is either to use a map of some sort, otherwise, Objects are dynamically row-typed, or you can use the introspective functions to pick and peel apart any type in the system to see and access what is inside.</p>
</blockquote>
</aside>
<p>They currently consider it to include for the lenses in <a href="https://github.com/gusty/FSharpPlus/issues/74" rel="noopener nofollow ugc">F# Plus.</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="65879" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/69">Post #68</a>
	                </div>
	            </div>
              <div id="likers-container-65879" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="65879"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #68"></div>
  </section>
</div>
    <div class="postbit" id="65934" data-post-id="65934">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="ShalokShalom" data-post="69" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>You can read about them here</p>
</blockquote>
</aside>
<p>Ah so a monad <code>do</code> notation, what is with the weird name (Microsoft’isms I guess?).  There is a super-popular PPX for that in OCaml (that library is brought in just about every sizeable OCaml project).  But see, unlike needing language constructs, OCaml tends to prefer libraries (very much like C++ in this way).  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="69" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Why Ruby? I see Ruby as comparable sane, syntax wise. Of course again from the view of a newbie.</p>
</blockquote>
</aside>
<p>Mostly in it’s verbosity.  Even Elixir is super verbose compared to Erlang (excepting Macro’s).</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="69" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>They currently consider it to include for the lenses in F# Plus.</p>
</blockquote>
</aside>
<p>There is a PPX to autogenerate accessors/transformers/etc. as well as a Lens PPX (though most prefer the accessors/transformers as they are <em>far</em> easier to read than lens’s) for OCaml that are also super-popular enough to be in about every sizeable project.  ^.^</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="65934" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/70">Post #69</a>
	                </div>
	            </div>
              <div id="likers-container-65934" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="65934"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #69"></div>
  </section>
</div>
    <div class="postbit" id="65939" data-post-id="65939">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="ShalokShalom" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ShalokShalom/120/15829_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  ShalokShalom
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="70" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>But see, unlike needing language constructs, OCaml tends to prefer libraries</p>
</blockquote>
</aside>
<p>Why needing?</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="70" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>There is a PPX to autogenerate accessors/transformers</p>
</blockquote>
</aside>
<p>Can you link me something about accessors/transformers, since Google is silent about it?<br>
And also this library, thanks. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="65939" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/71">Post #70</a>
	                </div>
	            </div>
              <div id="likers-container-65939" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="65939"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #70"></div>
  </section>
</div>
    <div class="postbit" id="65954" data-post-id="65954">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="ShalokShalom" data-post="71" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Why needing?</p>
</blockquote>
</aside>
<p>That’s a fantastic question!  Why do they do that?  ^.^;</p>
<aside class="quote no-group" data-username="ShalokShalom" data-post="71" data-topic="3693">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/shalokshalom/48/15829_2.png" class="avatar"> ShalokShalom:</div>
<blockquote>
<p>Can you link me something about accessors/transformers, since Google is silent about it?<br>
And also this library, thanks. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>There are a few for different types that you may want, since your original bit was about records then I prefer this one:<br>
<a href="https://github.com/janestreet/ppx_fields_conv" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/janestreet/ppx_fields_conv</a></p>
<p>To paraphrase it’s readme, it can from this record:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">type t = {
  dir : [ `Buy | `Sell ];
  quantity : int;
  price : float;
  mutable cancelled : bool;
} [@@deriving fields]
</code></pre>
<p>It will generate a whole host of accessors, transformers, and more:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">(* Auto-generated *)

(* getters *)
val cancelled : t -&gt; bool
val price     : t -&gt; float
val quantity  : t -&gt; int
val dir       : t -&gt; [ `Buy | `Sell ]

(* setters *)
val set_cancelled : t -&gt; bool -&gt; unit

(* higher order fields and functions over all fields *)
module Fields : sig

  val names : string list

  val cancelled : (t, bool            ) Field.t
  val price     : (t, float           ) Field.t
  val quantity  : (t, int             ) Field.t
  val dir       : (t, [ `Buy | `Sell ]) Field.t

  val create
    :  dir:[ `Buy | `Sell ]
    -&gt; quantity  : int
    -&gt; price     : float
    -&gt; cancelled : bool
    -&gt; t

  val make_creator
    :  dir:      ((t, [ `Buy | `Sell ]) Field.t -&gt; 'a -&gt; ('arg -&gt; [ `Buy | `Sell ]) * 'b)
    -&gt; quantity: ((t, int             ) Field.t -&gt; 'b -&gt; ('arg -&gt; int             ) * 'c)
    -&gt; price:    ((t, float           ) Field.t -&gt; 'c -&gt; ('arg -&gt; float           ) * 'd)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; 'd -&gt; ('arg -&gt; bool            ) * 'e)
    -&gt; 'a -&gt; ('arg -&gt; t) * 'e

  val fold
    :  init:'a
    -&gt; dir      :('a -&gt; (t, [ `Buy | `Sell ]) Field.t -&gt; 'b)
    -&gt; quantity :('b -&gt; (t, int             ) Field.t -&gt; 'c)
    -&gt; price    :('c -&gt; (t, float           ) Field.t -&gt; 'd)
    -&gt; cancelled:('d -&gt; (t, bool            ) Field.t -&gt; 'e)
    -&gt; 'e

  val map
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; [ `Buy | `Sell ])
    -&gt; quantity :((t, int             ) Field.t -&gt; int)
    -&gt; price    :((t, float           ) Field.t -&gt; float)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; bool)
    -&gt; t

  val iter
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; unit)
    -&gt; quantity :((t, int             ) Field.t -&gt; unit)
    -&gt; price    :((t, float           ) Field.t -&gt; unit)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; unit)
    -&gt; unit

  val for_all
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; bool)
    -&gt; quantity :((t, int             ) Field.t -&gt; bool)
    -&gt; price    :((t, float           ) Field.t -&gt; bool)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; bool)
    -&gt; bool

  val exists
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; bool)
    -&gt; quantity :((t, int             ) Field.t -&gt; bool)
    -&gt; price    :((t, float           ) Field.t -&gt; bool)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; bool)
    -&gt; bool

  val to_list
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; 'a)
    -&gt; quantity :((t, int             ) Field.t -&gt; 'a)
    -&gt; price    :((t, float           ) Field.t -&gt; 'a)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; 'a)
    -&gt; 'a list

  val map_poly : ([&lt; `Read | `Set_and_create ], t, 'a) Field.user -&gt; 'a list

  (** Functions that take a record directly *)
  module Direct : sig

      val fold
        :  t
        -&gt; init:'a
        -&gt; dir      :('a -&gt; (t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; 'b)
        -&gt; quantity :('b -&gt; (t, int             ) Field.t -&gt; t -&gt; int              -&gt; 'c)
        -&gt; price    :('c -&gt; (t, float           ) Field.t -&gt; t -&gt; float            -&gt; 'd)
        -&gt; cancelled:('d -&gt; (t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; 'e)
        -&gt; 'e

      val map
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; [ `Buy | `Sell ])
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; int)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; float)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; bool)
        -&gt; t

      val iter
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; unit)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; unit)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; unit)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; unit)
        -&gt; unit

      val for_all
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; bool)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; bool)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; bool)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; bool)
        -&gt; bool

      val exists
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; bool)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; bool)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; bool)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; bool)
        -&gt; bool

      val to_list
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; 'a)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; 'a)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; 'a)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; 'a)
        -&gt; 'a list
        
      val set_all_mutable_fields : t -&gt; cancelled:bool -&gt; unit
    end

end
</code></pre>
<p>In addition it allows some other libraries to easily introspect into the given records as well.</p>
<p>Let’s break up each part into why it’s useful:</p>
<h3><a name="p-65954-getters-1" class="anchor" href="#p-65954-getters-1" aria-label="Heading link" rel="nofollow"></a>Getters</h3>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">val cancelled : t -&gt; bool
val price     : t -&gt; float
val quantity  : t -&gt; int
val dir       : t -&gt; [ `Buy | `Sell ]
</code></pre>
<p>The usefulness of this should be obvious, let’s you pass pre-made accessor functions around (think the <code>.blah</code> calls of Elm).  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<h3><a name="p-65954-setters-2" class="anchor" href="#p-65954-setters-2" aria-label="Heading link" rel="nofollow"></a>Setters</h3>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">val set_cancelled : t -&gt; bool -&gt; unit
</code></pre>
<p>If you have any fields in it that are mutable then this gives you convenient pre-made functions that you can pass around to update them (great for callbacks!).</p>
<h3><a name="p-65954-higher-order-fields-and-functions-over-all-fields-3" class="anchor" href="#p-65954-higher-order-fields-and-functions-over-all-fields-3" aria-label="Heading link" rel="nofollow"></a>Higher order fields and functions over all fields</h3>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">module Fields : sig
</code></pre>
<p>This is a submodule of various useful and repeatable calls.  Note that this module can be passed as a first-class module to functions to be used as a callback module (following the standard naming conventions for ease of compatibility), think of it like a static-lens-on-steroids (able to mess with all fields, or some, or whatever):</p>
<h4><a name="p-65954-field-names-4" class="anchor" href="#p-65954-field-names-4" aria-label="Heading link" rel="nofollow"></a>Field names</h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  val names : string list
</code></pre>
<p>A string list of field names, a very useful and efficient helper for introspection (often used by json generator libraries as just one example of many).</p>
<h4><a name="p-65954-field-introspection-objects-5" class="anchor" href="#p-65954-field-introspection-objects-5" aria-label="Heading link" rel="nofollow"></a>Field introspection objects</h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  val cancelled : (t, bool            ) Field.t
  val price     : (t, float           ) Field.t
  val quantity  : (t, int             ) Field.t
  val dir       : (t, [ `Buy | `Sell ]) Field.t
</code></pre>
<p>Very easy to use field introspection objects, <em>significantly</em> easier to use than raw reflection and can be used as Lens’s to boot!</p>
<h4><a name="p-65954-create-6" class="anchor" href="#p-65954-create-6" aria-label="Heading link" rel="nofollow"></a><code>create</code></h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  val create
    :  dir:[ `Buy | `Sell ]
    -&gt; quantity  : int
    -&gt; price     : float
    -&gt; cancelled : bool
    -&gt; t
</code></pre>
<p>Just a simple helper function that you can pass around to construct a record via passed-in arguments, great again for passing to callbacks!</p>
<h4><a name="p-65954-make_creator-7" class="anchor" href="#p-65954-make_creator-7" aria-label="Heading link" rel="nofollow"></a><code>make_creator</code></h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  val make_creator
    :  dir:      ((t, [ `Buy | `Sell ]) Field.t -&gt; 'a -&gt; ('arg -&gt; [ `Buy | `Sell ]) * 'b)
    -&gt; quantity: ((t, int             ) Field.t -&gt; 'b -&gt; ('arg -&gt; int             ) * 'c)
    -&gt; price:    ((t, float           ) Field.t -&gt; 'c -&gt; ('arg -&gt; float           ) * 'd)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; 'd -&gt; ('arg -&gt; bool            ) * 'e)
    -&gt; 'a -&gt; ('arg -&gt; t) * 'e
</code></pre>
<p>This takes a set of functions, one-per-field-of-the-record, and finally it returns a function that takes an argument, that argument is passed to each callback function to construct the needed value for that field, where finally the record is full returned, each function able to pass along an accumulator to hold state.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<h4><a name="p-65954-fold-map-iter-for_all-exists-8" class="anchor" href="#p-65954-fold-map-iter-for_all-exists-8" aria-label="Heading link" rel="nofollow"></a><code>fold</code> / <code>map</code> / <code>iter</code> / <code>for_all</code> / <code>exists</code></h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  val fold
    :  init:'a
    -&gt; dir      :('a -&gt; (t, [ `Buy | `Sell ]) Field.t -&gt; 'b)
    -&gt; quantity :('b -&gt; (t, int             ) Field.t -&gt; 'c)
    -&gt; price    :('c -&gt; (t, float           ) Field.t -&gt; 'd)
    -&gt; cancelled:('d -&gt; (t, bool            ) Field.t -&gt; 'e)
    -&gt; 'e

  val map
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; [ `Buy | `Sell ])
    -&gt; quantity :((t, int             ) Field.t -&gt; int)
    -&gt; price    :((t, float           ) Field.t -&gt; float)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; bool)
    -&gt; t

  val iter
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; unit)
    -&gt; quantity :((t, int             ) Field.t -&gt; unit)
    -&gt; price    :((t, float           ) Field.t -&gt; unit)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; unit)
    -&gt; unit

  val for_all
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; bool)
    -&gt; quantity :((t, int             ) Field.t -&gt; bool)
    -&gt; price    :((t, float           ) Field.t -&gt; bool)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; bool)
    -&gt; bool

  val exists
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; bool)
    -&gt; quantity :((t, int             ) Field.t -&gt; bool)
    -&gt; price    :((t, float           ) Field.t -&gt; bool)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; bool)
    -&gt; bool
</code></pre>
<p>Generic transformation functions, like the ones in Elixir except they operate over each field, they are all fantastic helpers and are very often used when this module is used as a first-class module witness.</p>
<h4><a name="p-65954-to_list-9" class="anchor" href="#p-65954-to_list-9" aria-label="Heading link" rel="nofollow"></a><code>to_list</code></h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  val to_list
    :  dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; 'a)
    -&gt; quantity :((t, int             ) Field.t -&gt; 'a)
    -&gt; price    :((t, float           ) Field.t -&gt; 'a)
    -&gt; cancelled:((t, bool            ) Field.t -&gt; 'a)
    -&gt; 'a list
</code></pre>
<p>A reduction function that reduces to a uni-typed list, great to use to be able to pass a record to other things for transformations.</p>
<h4><a name="p-65954-map_poly-10" class="anchor" href="#p-65954-map_poly-10" aria-label="Heading link" rel="nofollow"></a><code>map_poly</code></h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  val map_poly : ([&lt; `Read | `Set_and_create ], t, 'a) Field.user -&gt; 'a list
</code></pre>
<p>A polymorphic mapping function that returns polymorphic variants of the requisite field information.</p>
<h4><a name="p-65954-direct-11" class="anchor" href="#p-65954-direct-11" aria-label="Heading link" rel="nofollow"></a>Direct</h4>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">  module Direct : sig

      val fold
        :  t
        -&gt; init:'a
        -&gt; dir      :('a -&gt; (t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; 'b)
        -&gt; quantity :('b -&gt; (t, int             ) Field.t -&gt; t -&gt; int              -&gt; 'c)
        -&gt; price    :('c -&gt; (t, float           ) Field.t -&gt; t -&gt; float            -&gt; 'd)
        -&gt; cancelled:('d -&gt; (t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; 'e)
        -&gt; 'e

      val map
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; [ `Buy | `Sell ])
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; int)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; float)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; bool)
        -&gt; t

      val iter
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; unit)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; unit)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; unit)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; unit)
        -&gt; unit

      val for_all
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; bool)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; bool)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; bool)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; bool)
        -&gt; bool

      val exists
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; bool)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; bool)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; bool)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; bool)
        -&gt; bool

      val to_list
        :  t
        -&gt; dir      :((t, [ `Buy | `Sell ]) Field.t -&gt; t -&gt; [ `Buy | `Sell ] -&gt; 'a)
        -&gt; quantity :((t, int             ) Field.t -&gt; t -&gt; int              -&gt; 'a)
        -&gt; price    :((t, float           ) Field.t -&gt; t -&gt; float            -&gt; 'a)
        -&gt; cancelled:((t, bool            ) Field.t -&gt; t -&gt; bool             -&gt; 'a)
        -&gt; 'a list
        
      val set_all_mutable_fields : t -&gt; cancelled:bool -&gt; unit
    end
</code></pre>
<p>A sub module inside this sub module, it adds a lot of transformation functions that operate over the record in it’s first call position, I.E. just a set of helpers from the above with arguments shuffled to make different use-cases easier.</p>
<p>&nbsp;</p>
<p>And this is just one of many many PPX’s for OCaml.</p>
<p>Like this one is like the record one above, but for variants (with variant-specific things and without record specific things):<br>
<a href="https://github.com/janestreet/ppx_variants_conv" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/janestreet/ppx_variants_conv</a></p>
<p>And a matcher view transformer for transforming match expressions (Hmm, I just realized this is very much like Active patterns in F#, I wonder if this is where F# got its idea from…):<br>
<a href="https://github.com/ocaml-ppx/ppx_view" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/ocaml-ppx/ppx_view</a></p>
<p>There is of course the all-popular <code>deriving</code> PPX that let’s other PPX’s make easy deriving integration (deriving is similar to Elixir’s <code>@derive</code> definition), often used for JSON generation, XML, auto-comparisons, etc… etc…:<br>
<a href="https://github.com/ocaml-ppx/ppx_deriving" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/ocaml-ppx/ppx_deriving</a></p>
<p>A great PPX to reduce type declarations when you are needing to extend the functions of a type you do not control:<br>
<a href="https://github.com/ocaml-ppx/ppx_import" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/ocaml-ppx/ppx_import</a></p>
<p>And a PPX that adds Elixir-like macro’s (it even adds a <code>quote</code>-like form with unquote too! It’s <code>quote</code> is called <code>code</code> and unquote is called <code>e</code>, though the macros are not  hidden in the syntax as it is in Elixir, they require an explicit declaration to reify them into inline code, which I actually quite prefer to be honest… less magic unlike Elixir):<br>
<a href="https://github.com/stedolan/ppx_stage" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/stedolan/ppx_stage</a></p>
<p>That one works like (using the <code>unless</code> macro in the <a href="https://elixir-lang.org/getting-started/meta/macros.html" rel="nofollow">Elixir Getting Started Macro Guide</a> converted to OCaml):</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">let unless clause do_code =
  [%code
    if [%e clause]
    then ()
    else [%e do_code]
  ]

let test = Ppx_stage.run (unless [%code false] [%code print_string "vwhoo!"])
</code></pre>
<p>Of course as stated before the macro calls are not just magic function-like calls like in Elixir, you have to ‘initiate’ it by calling <code>run</code> on it, which actually inlines it at compile-time in place, so the above just ends up becoming:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">let test = if false then () else print_string "vwhoo!"
</code></pre>
<p>It is designed to be a speed boost, not something you should really use (macro’s are discouraged in OCaml overall).</p>
<p>If you really <em>really</em> want function-like macro’s then you’ll use the caml4p front-end for OCaml (it’s another library, a PP library this time, kind of like reason but more powerful and different syntax, it used to be built in to OCaml but it was pulled out into a library many many versions ago), but that is generally discouraged for general work, and yet it is still very used, so eh…  I prefer the <code>stage</code> style as I prefer explicitness even if more verbose (that just makes sure that I’m only using it where it really matters then).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="65954" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/mlelixir-attempting-an-ml-traditional-syntax-entirely-within-the-elixir-ast/3693/72">Post #71</a>
	                </div>
	            </div>
              <div id="likers-container-65954" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="65954"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #71"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/3693/load_more?page=8">Load more posts (36 remaining)</a>
</div></template></turbo-stream>