[Omake] short-circuit returns
Nathaniel Gray
n8gray at caltech.edu
Thu Aug 9 16:14:13 PDT 2007
Ok, maybe I should just give you some actual code that triggers the
problem. My goal is to find a description of why a build failed and
send it to growlnotify. This is in my ~/.omakerc:
section
.BUILD_BEGIN:
echo
echo "Build beginning" | growlnotify -n OMake OMake
.BUILD_SUCCESS:
echo "Build succeeded!" | growlnotify -p -2 -n OMake OMake
.BUILD_FAILURE:
section
targs = $(find-build-targets Failed)
any-output-file(targs) =
foreach(x, $(targs))
if $(x.output-file)
return $(x.output-file)
return $(BUILD_SUMMARY)
f = $(any-output-file $(targs))
shell(cat $(f) | growlnotify -s -p 2 -n OMake OMake:
Build Failed!)
On Aug 9, 2007, at 3:53 PM, Jason Hickey wrote:
> I must have the example wrong, but I can't reproduce this. Here is
> the program I'm using.
>
> is-tasty(x) =
> match $x
> case tasty
> value true
> default
> value false
>
> new-tasty(x) =
> value $"$x pies"
>
> get-tasty(args) =
> foreach(x, $(args))
> if $(is-tasty $(x))
> return $(x)
> return $(new-tasty 123)
>
> println($(get-tasty yum not-tasty tasty-freeze))
>
> Jason
>
> On Aug 9, 2007, at 3:28 PM, Nathaniel Gray wrote:
>
>> Hi guys,
>>
>> OMake 0.9.8.5 behaves differently than previous versions on some
>> return statements. In particular, it seems to dislike returns
>> that exit early from functions. So this function that used to
>> work now gives "Misplaced return statement" on the first return:
>>
>> get-tasty(args) =
>> foreach(x, $(args))
>> if $(is-tasty $(x))
>> return $(x)
>> return $(new-tasty 123)
>>
>> Is this expected behavior?
>>
>> Thanks,
>> -n8
>>
>> --
>> >>>-- Nathaniel Gray -- Caltech Computer Science ------>
>> >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->
>>
>>
>> _______________________________________________
>> Omake mailing list
>> Omake at metaprl.org
>> https://lists.metaprl.org/mailman/listinfo/omake
>
> --
> Jason Hickey http://www.cs.caltech.edu/~jyh
> Caltech Computer Science Tel: 626-395-6568 FAX: 626-792-4257
>
>
>
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
>
--
>>>-- Nathaniel Gray -- Caltech Computer Science ------>
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->
More information about the Omake
mailing list