comparison website/src/diff.html.luan @ 1813:fa0e73119b7c

docs work
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 10 Jun 2024 23:19:40 -0600
parents f44dcb3fedf7
children 0ead5c6b07b0
comparison
equal deleted inserted replaced
1812:f44dcb3fedf7 1813:fa0e73119b7c
25 subs = { 25 subs = {
26 types = { 26 types = {
27 title = "Values and Types" 27 title = "Values and Types"
28 content = function() 28 content = function()
29 %> 29 %>
30 <p>Luan does not have the Lua <em>thread</em> type. Luan adds a <em>binary</em> type that Lua doesn't have. This is because Lua strings can represent binary while Luan strings cannot.</p> 30 <p>Luan adds a <em>binary</em> type that Lua doesn't have. This is because Lua strings can represent binary while Luan strings cannot.</p>
31 31
32 <p>The Luan <em>Nil</em> type is implemented as the Java <em>null</em>. The Luan <em>Boolean</em> type is implemented as the Java <em>Boolean</em> type. The Luan <em>Number</em> type is implemented as the Java <em>Number</em> type. The Luan <em>String</em> type is implemented as the Java <em>String</em> type. Actual numbers may be any subclass of the Java <em>Number</em> class.</p> 32 <p>The Luan <em>Nil</em> type is implemented as the Java <em>null</em>. The Luan <em>Boolean</em> type is implemented as the Java <em>Boolean</em> type. The Luan <em>Number</em> type is implemented as the Java <em>Number</em> type. The Luan <em>String</em> type is implemented as the Java <em>String</em> type. Actual numbers may be any subclass of the Java <em>Number</em> class.</p>
33 33
34 <p>Luan functions may be written in Luan or may be wrappers around native Java methods. Any Java method may be called as a Luan function.</p> 34 <p>Luan functions may be written in Luan or may be wrappers around native Java methods. Any Java method may be called as a Luan function.</p>
35 35
36 <p>The Luan <em>java</em> type is a replacement for Lua's <em>userdata</em>. A Luan <em>java</em> value is nothing more than a Java object that doesn't fall into one of the other recognized types.</p> 36 <p>The Luan <em>java</em> type is a replacement for Lua's <em>userdata</em>. A Luan <em>java</em> value is nothing more than a Java object that doesn't fall into one of the other recognized types.</p>
37 37
38 <p>The Luan <em>binary</em> type is the Java <em>byte[ ]</em> type which is an array of bytes.</p> 38 <p>The Luan <em>binary</em> type is the Java <em>byte[ ]</em> type which is an array of bytes.</p>
39 39
40 <p>The Luan <em>table</em> type is just like its Lua equivalent, but implemented in Java.</p> 40 <p>The Luan <em>table</em> type is just like its Lua equivalent, but implemented in Java.</p>
41
42 <p>Luan does not have the Lua <em>thread</em> type which aren't actually threads but in fact are coroutines. Luan has real threads. This is particularly valuable for web serving where each request is handled by a thread. But thread synchronization is too complicated for application programmers. So Luan makes objects (tables) immutable when they become accessible by multiple threads. This eliminates the need for thread synchronization. If there is a need to share mutable state across threads, there are special thread-local functions for this.</p>
41 <% 43 <%
42 end 44 end
43 } 45 }
44 env = { 46 env = {
45 title = "Environments" 47 title = "Environments"