Preprocessing of I6 in 10.1?

Is there some kind of pre-processing of I6 inclusions in 10.1? I noticed some surprising things recently:

  1. The I7 compiler can throw errors and halt for code that is commented out with !.
  2. Some I6 that should have been deemed illegal by the I6 compiler (an objectloop block lacking a closing curly brace) instead compiled and ran.
2 Likes

It’s not exactly preprocessing…

I7 first compiles I6 code (kits and inclusions) using Inter, which is a new implementation of the I6 compiler which generates (in-memory) Inter node trees. In a later step, the Inter trees are used to generate I6 again, which then goes through the “classic” I6 compiler.

(This seems weirdly redundant, but Inter is designed to be better for the “linking” step of kits and so on inside I7. Also, you might be building C instead, in which case the path is I6 → Inter → C source → C compiler.)

The Inter compiler is supposed to be compatible with the “classic” I6 compiler, but there are still rough spots. You can report them on Jira.

3 Likes

I’ve only seen that happen with I7 inside (+ +) in an I6 inclusion. Have you seen other cases?

There are several specific cases of valid I6 that won’t compile in I7, but this is the first I’ve heard of invalid I6 that compiles – could you provide the example, please?

The examples that I encountered did involve commented-out (+ ... +) constructions; I haven’t seen any others.

Here’s a short example for the unclosed block issue:

"Missing Curly Brace"

Place is a room.

Alice is a woman in Place.
Bob is a man in Place.

To exampleloop:
	(- ExampleLoop(); -).

When play begins:
	exampleloop.

Include (-

[ ExampleLoop tmp ;
	objectloop (tmp && tmp ofclass (+ person +)) {
		print "person: ", (name) tmp, "^";
	} ! still compiles and runs if this line (including closing curly brace) is removed
	print "All done!^";
];

-).
1 Like

I’ve reported this as I7-2359.

1 Like

You should think of Inform 10’s use of I6 actually as a related language that’s about 98% the same, but has a few unexpected differences. Some are unintended bugs, but some are deliberate. I think there’s a page in the docs that details some of the differences, but I haven’t been able to find it.

For example, this part of Data Structures no longer works in 10.1:

To if kind/type/-- of/-- (A - any) is (name of kind of value K) let (V - nonexisting K variable) be the value begin -- end loop:
	(- if (BlkValueRead({-by-reference:A}, ANY_TY_KOV) == {-strong-kind:K} && (
		(KOVIsBlockValue({-strong-kind:K})
			&& BlkValueCopy({-lvalue-by-reference:V}, BlkValueRead({-by-reference:A}, ANY_TY_VALUE))
			|| ({-lvalue-by-reference:V} = BlkValueRead({-by-reference:A}, ANY_TY_VALUE))
		)
	, 1)) -).

I’m not sure why, but I’d guess that perhaps the comma operator hasn’t been implemented properly or fully.

Edit: I found this brief summary, but there might be a fuller description elsewhere in the docs:

Some antique syntaxes, such as for loops broken with semicolons not colons, are missing; so are some hardly-used directives; and the superclass :: operator; and built-in compiler symbols relevant only to particular virtual machines, such as #g$self, are not there. But really, you will never notice they are gone.

1 Like

These are what I know of in terms of providing any details:

[ edited to add I7-2267, I7-2335: figured it’d be good to have these together somewhere. ]

1 Like

Reader, I noticed.

1 Like

Those obscure little things like individual properties, you know.

Reimplementing I6 from the ground up for the Inter system is a phenomenal effort and I don’t want to undersell that, but I really wish there were documentation on all the ways it differs from standard I6 so we didn’t have to find them by trial and error.

2 Likes