<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Expressions on JFuncMachine</title>
    <link>https://jfuncmachine.org/overview/expressions/index.html</link>
    <description>Recent content in Expressions on JFuncMachine</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 13 Dec 2023 19:56:51 -0500</lastBuildDate>
    <atom:link href="https://jfuncmachine.org/overview/expressions/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Local Variables</title>
      <link>https://jfuncmachine.org/overview/expressions/variables/index.html</link>
      <pubDate>Wed, 13 Dec 2023 19:56:51 -0500</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/variables/index.html</guid>
      <description>Local variables, as opposed to class/object fields, are defined only for the life of a method. If a method has any parameters, those parameters are available to the method body as local variables, with names that match the declared method parameter names.
For object methods, as opposed to static methods, there is also an implicit local variable named &amp;ldquo;this&amp;rdquo;, that is a reference to the object that the method is being executed on.</description>
    </item>
    <item>
      <title>If</title>
      <link>https://jfuncmachine.org/overview/expressions/if/index.html</link>
      <pubDate>Wed, 13 Dec 2023 19:56:51 -0500</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/if/index.html</guid>
      <description>An If expression performs a test, and if the test is true it executes an expression, and if the test is false, it executes a different expression. In some functional languages, an if expression is required to have both a true and false expression. JFuncMachine allows for having only a true expression if the true expression has type SimpleTypes.UNIT.
Like a typical functional language, If is an expression, not a statement.</description>
    </item>
    <item>
      <title>Inline Functions</title>
      <link>https://jfuncmachine.org/overview/expressions/inlines/index.html</link>
      <pubDate>Wed, 13 Dec 2023 19:56:51 -0500</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/inlines/index.html</guid>
      <description>Simple operations like additional and multiplication are often represented as functions in functional languages. Many of these operations are implemented in Java as single instructions, and it is far more efficient to execute a single add instruction than to invoke an add function.
JFuncMachine provides a number of inline functions to perform these operations without doing a method/function call. The InlineCall expression takes a reference to an inline function, and an array of expressions containing the function arguments.</description>
    </item>
    <item>
      <title>Blocks</title>
      <link>https://jfuncmachine.org/overview/expressions/block/index.html</link>
      <pubDate>Wed, 13 Dec 2023 19:56:51 -0500</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/block/index.html</guid>
      <description>Sometimes it is necessary to execute a series of expressions where the expressions are executed for their side-effects. For example, you may want to print some things before returning a value. The Block expressions executes a sequence of expressions, discarding the result values of each expression except the last, which becomes the return value of the block.
This example of a block is not very useful, but shows how it allows a sequence of expressions.</description>
    </item>
    <item>
      <title>Arrays</title>
      <link>https://jfuncmachine.org/overview/expressions/arrays/index.html</link>
      <pubDate>Wed, 13 Dec 2023 19:56:51 -0500</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/arrays/index.html</guid>
      <description>JFuncMachine provides expressions to get and set values in an array and also to create new arrays.
Creating New Arrays The NewArray expression takes an array element type and an expression indicating the desired array size, and allocates a new array.
The following method takes an array size as a parameter and returns an array of bytes corresponding to the size:
MethodDef method = new MethodDef(&amp;#34;arraytest&amp;#34;, Access.PUBLIC, new Field[] { new Field(&amp;#34;n&amp;#34;, SimpleTypes.</description>
    </item>
    <item>
      <title>Switch</title>
      <link>https://jfuncmachine.org/overview/expressions/switch/index.html</link>
      <pubDate>Wed, 13 Dec 2023 19:56:51 -0500</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/switch/index.html</guid>
      <description>In Java a switch statement is a compact kind of if statement that chooses one of several options. The JVM has two instructions for performing switches, and both are for switching on integers. Starting as a preview in Java 17, and then officially added in Java 21, there are two helper bootstrap methods to allow switching on types (plus strings and integers), and enum values. Technically, these still use one of the instructions for switching on integers, but the bootstrap methods create a dynamic call that can take a class, string, integer, or enum and generate an integer that can be switched on.</description>
    </item>
    <item>
      <title>Java Interop</title>
      <link>https://jfuncmachine.org/overview/expressions/javainterop/index.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/javainterop/index.html</guid>
      <description>JFuncMachine provides several expressions for interacting with Java objects. JFuncMachine does not provide any kind of data structures, so it is anticipated that language implementations will use Java classes to implement the structures they need, making the Java Interop expressions extremely important.
A language implementation has to do a little more work here than usual, because JFuncMachine doesn&amp;rsquo;t try to inspect any Java objects referenced in Java interop, meaning it can compile classes to reference classes that aren&amp;rsquo;t in the classpath at compile time.</description>
    </item>
    <item>
      <title>Method Calls</title>
      <link>https://jfuncmachine.org/overview/expressions/methods/index.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/methods/index.html</guid>
      <description>It might seem that methods are very straightforward, and if you stick to the method calls in the javainterop package, then there should be no surprises. However, JFuncMachine provides CallMethod, CallStaticMethod, CallTailCallMethod, and CallTailCallStaticMethod.
Tail Calls One of the common features of functional programming languages is that they support tail call optimization. This means that when a function calls another function from the tail position - that is, when the function call is the return value of the calling function, then the new function call can reuse the stack space of the current function.</description>
    </item>
    <item>
      <title>Method Pointers and Partial Calls</title>
      <link>https://jfuncmachine.org/overview/expressions/methodptrs/index.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/methodptrs/index.html</guid>
      <description>Method Pointers Often in functional languages you want to pass functions to other functions. For example, the map function in several functional languages takes a function and a list, and applies the function to each member of the list, returning a list of the results.
JFuncMachine provides a way to make a pointers to methods and constructors. When a pointer points to an instance or an interface method, you have the option to supply the object that contains the method or not.</description>
    </item>
    <item>
      <title>Try-Catch-Finally</title>
      <link>https://jfuncmachine.org/overview/expressions/trycatch/index.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://jfuncmachine.org/overview/expressions/trycatch/index.html</guid>
      <description>Exceptions are a difficult language feature in several ways. Some functional languages like OCaml implement exceptions in a way that is fairly cheap from a proessing standpoint. Java does not, so there is some question as to whether you would want to include Java exceptions in a functional language for the JVM.
But, just in case you do, JFuncMachine provides a TryCatchFinally expression. You can supply an expression to try, an array of 0 or more catch blocks that each catch a certain type of exception and execute an expression.</description>
    </item>
  </channel>
</rss>