[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: JIT - automated mexing
From: |
Alexander Barth |
Subject: |
Re: JIT - automated mexing |
Date: |
Mon, 26 Jul 2010 17:42:51 +0200 |
On Mon, Jul 26, 2010 at 4:19 PM, Judd Storrs <address@hidden> wrote:
> On Mon, Jul 26, 2010 at 9:44 AM, Alexander Barth <address@hidden>
> wrote:
>>
>> If one wants to assign a variable of another type, then one would get
>> a runtime error:
>> a = 1; % ok
>> a = 'some string'; % error
>
> I've been pondering along the same lines. Where I get hung up is how would
> one declare unnamed intermediates values (returned by functions and used in
> the middle of expressions)? I guess the code could be rewritten to remove
> intermediates, but then the uncompiled code would perform worse?
>
> --judd
yes, that's right. The code translator would also need to know the
prototype of each function in particular the type of the output
arguments (as this is the case in C and C++). But instead of writing
explicit header files for each m-function, one could extract those
information directly from the type declaration in the code. For
example:
function x = foo(a,b)
%oct-type a,x double
%oct-type b int
x = a+b
foo is called by an expression such as:
result = other_function(foo(3,4))
>From the type declarations in foo, the compiler knowns that foo
returns a double and can thus declare an intermediate variable of this
type (if this would be necessary).
Cheers,
Alex
- Re: JIT - automated mexing, Alexander Barth, 2010/07/26
- Re: JIT - automated mexing, Judd Storrs, 2010/07/26
- Re: JIT - automated mexing,
Alexander Barth <=
- Re: JIT - automated mexing, Judd Storrs, 2010/07/26
- Re: JIT - automated mexing, Jaroslav Hajek, 2010/07/26
- Re: JIT - automated mexing, Alexander Barth, 2010/07/28
- Re: JIT - automated mexing, Jaroslav Hajek, 2010/07/28
- Re: JIT - automated mexing, Judd Storrs, 2010/07/28
- Re: JIT - automated mexing, Jaroslav Hajek, 2010/07/29