[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New very simple methodology to create a m-file compiler.

From: Nicholas Jankowski
Subject: Re: New very simple methodology to create a m-file compiler.
Date: Mon, 6 May 2019 23:13:49 -0400

On Mon, May 6, 2019 at 10:40 AM GoSim <address@hidden> wrote:
regarding type from function:

if it is a new variable the type is needed to declare it, if it is an
already used variable it is enough to know it doesn't change type.


A similar question was asked on StackOverflow about polymorphic functions, and they gave a very simple example of a function that could return multiple types, even non-predictably.

I also found an EETimes article talking about the difficulty in writing a Matlab-to-C translator, and polymorphism came up, among other things, as a particularly challenging translation problem.

I haven't identified any non-custom function that produces highly polymorphic output yet, maybe someone else can think of one.  but a simple:

a = 1;
b = 'foo';
[b, a] = deal(a, b)
b = 1
a = foo

could be a problem i guess. this example might be easy to catch, and maybe even correct for, but only if you include 'deal' on a compiler blacklist of functions that can change variable type.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]