9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Inferno, Limbo unexpectancies
@ 2002-02-14 15:40 forsyth
  2002-02-18 10:13 ` Maarit Maliniemi
  0 siblings, 1 reply; 6+ messages in thread
From: forsyth @ 2002-02-14 15:40 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

>>1 shadowing

shad.b:12: warning: redeclaration of local n, previously declared as a local on line shad.b:10

request warnings and you'll get them (-w option to limbo)

>>2 no bounds check in JIT

there's a plan to make them available in JIT mode as well.
(at least optionally: there are some things that can be proved
correct and don't need them but could use the speed.)

[-- Attachment #2: Type: message/rfc822, Size: 3177 bytes --]

To: 9fans@cse.psu.edu
Subject: [9fans] Inferno, Limbo unexpectancies
Date: Thu, 14 Feb 2002 16:05:15 +0100 (MET)
Message-ID: <200202141505.g1EF5FP01844@cbe.ericsson.se>

With the Inferno mail list down I hope to reach 'the right people' here at 
9fans.

If Inferno related emails are considered bandwith waisting, please let me know 
and I will stop.

I have stumbled upon 2 things in Limbo that I would like to warn about 
(presumably somebody else is as stupid as I am :-)


1 Unintended variable shadowing:

n := 3
while (n > 0) {
	n:= n - 1; # i know of n--, but this is an example
}


as is obvious (afterwards), n will never reach 0.
i really think the compiler should warn about this.



2 No array bounds checking (only for JIT):

The below program will crash at the return statement in crash(), not in the 
for() loop. Moreover, this only happens when using JIT.


bengt

implement Crash;

include "draw.m";
include "sys.m";
	sys: Sys;


Crash: module {
	init:	fn(nil: ref Draw->Context, args: list of string);
};

init(nil: ref Draw->Context, args: list of string) {
	sys = load Sys Sys->PATH;

	a:= crash(  );
	
	return;
}

crash(  ): array of byte {
	result:= array [1] of byte;

	for (i:= 0; i < 10; i++) {
		sys->print( "%d\n", i );
		result[i] = byte 0;
		sys->print( "%d\n", len result );
	}

	return result[:5];
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Inferno, Limbo unexpectancies
  2002-02-14 15:40 [9fans] Inferno, Limbo unexpectancies forsyth
@ 2002-02-18 10:13 ` Maarit Maliniemi
  0 siblings, 0 replies; 6+ messages in thread
From: Maarit Maliniemi @ 2002-02-18 10:13 UTC (permalink / raw)
  To: 9fans

In article <20020214153452.6CD4D199BB@mail.cse.psu.edu>, 9fans@cse.psu.edu
wrote:


 
> >>1 shadowing
> 
> shad.b:12: warning: redeclaration of local n, previously declared as a
local on line shad.b:10
> 
> request warnings and you'll get them (-w option to limbo)
> 


Would it not be better with the opposite behaviour?
Ie, if somebody knows about limbo they can turn off warnings they do not need.
Whereas the not-so-knowledgable (eg they do not even know that there are
warnings available) get them since they presumably need them a lot more...


bengt


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Inferno, Limbo unexpectancies
@ 2002-02-15 12:52 Bengt Kleberg
  0 siblings, 0 replies; 6+ messages in thread
From: Bengt Kleberg @ 2002-02-15 12:52 UTC (permalink / raw)
  To: 9fans



> From: forsyth@caldo.demon.co.uk
> To: 9fans@cse.psu.edu
> Subject: Re: [9fans] Inferno, Limbo unexpectancies


> 
> >>With the Inferno mail list down I hope to reach 'the right people' here at 
> >>9fans.
> 
> i'm not sure what happened to it; at first it looked as though pip had
> gone on holiday and could mend it when he got back

That is what he said/wrote.


> but i think we'll set
> up yet another one ourselves.

Mail lists need 'Atleast one' semantics :-)


bengt



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Inferno, Limbo unexpectancies
  2002-02-14 15:43 forsyth
@ 2002-02-15  0:48 ` Sam Ducksworth
  0 siblings, 0 replies; 6+ messages in thread
From: Sam Ducksworth @ 2002-02-15  0:48 UTC (permalink / raw)
  To: 9fans

when/if you get a new list going please let us know.

> i'm not sure what happened to it; at first it looked as though pip had
> gone on holiday and could mend it when he got back but i think we'll set
> up yet another one ourselves.
>

--sam



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] Inferno, Limbo unexpectancies
@ 2002-02-14 15:43 forsyth
  2002-02-15  0:48 ` Sam Ducksworth
  0 siblings, 1 reply; 6+ messages in thread
From: forsyth @ 2002-02-14 15:43 UTC (permalink / raw)
  To: 9fans

>>With the Inferno mail list down I hope to reach 'the right people' here at 
>>9fans.

i'm not sure what happened to it; at first it looked as though pip had
gone on holiday and could mend it when he got back but i think we'll set
up yet another one ourselves.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] Inferno, Limbo unexpectancies
@ 2002-02-14 15:05 Bengt Kleberg
  0 siblings, 0 replies; 6+ messages in thread
From: Bengt Kleberg @ 2002-02-14 15:05 UTC (permalink / raw)
  To: 9fans

With the Inferno mail list down I hope to reach 'the right people' here at 
9fans.

If Inferno related emails are considered bandwith waisting, please let me know 
and I will stop.

I have stumbled upon 2 things in Limbo that I would like to warn about 
(presumably somebody else is as stupid as I am :-)


1 Unintended variable shadowing:

n := 3
while (n > 0) {
	n:= n - 1; # i know of n--, but this is an example
}


as is obvious (afterwards), n will never reach 0.
i really think the compiler should warn about this.



2 No array bounds checking (only for JIT):

The below program will crash at the return statement in crash(), not in the 
for() loop. Moreover, this only happens when using JIT.


bengt

implement Crash;

include "draw.m";
include "sys.m";
	sys: Sys;


Crash: module {
	init:	fn(nil: ref Draw->Context, args: list of string);
};

init(nil: ref Draw->Context, args: list of string) {
	sys = load Sys Sys->PATH;

	a:= crash(  );
	
	return;
}

crash(  ): array of byte {
	result:= array [1] of byte;

	for (i:= 0; i < 10; i++) {
		sys->print( "%d\n", i );
		result[i] = byte 0;
		sys->print( "%d\n", len result );
	}

	return result[:5];
}




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-02-18 10:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-14 15:40 [9fans] Inferno, Limbo unexpectancies forsyth
2002-02-18 10:13 ` Maarit Maliniemi
  -- strict thread matches above, loose matches on Subject: below --
2002-02-15 12:52 Bengt Kleberg
2002-02-14 15:43 forsyth
2002-02-15  0:48 ` Sam Ducksworth
2002-02-14 15:05 Bengt Kleberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).