From: | "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> |
Newsgroups: | comp.compilers |
Date: | 30 May 2006 18:38:46 -0400 |
Organization: | cbb software GmbH |
References: | 06-05-083 |
Keywords: | syntax |
Posted-Date: | 30 May 2006 18:38:46 EDT |
On 26 May 2006 12:51:40 -0400, olivier.chatelain@gmail.com wrote:
> What about using Plural => Singular transformations to generate loop
> variables from name of lists?
>
> EXAMPLE:
>
> FOR dependency IN dependencies DO
> PRINT dependency.name
> END
>
> = depenendcies -generates-> dependency =
>
> FORALL dependencies DO
> PRINT dependency.name
> END
>
> The compiler would generate the "singular" loop variable "dependency"
> from the List "dependencies" (Plural).
Hmm, what about
for Arrays do
for Arrays do
print Cov (Array.Element, Array.Element)
-- Would it print the covariance matrix?
end
end
The logical error is that the loop variable is not a property of the
iterated container. So you cannot derive its name from the container's name
alone. You could do it from the loop's name. For example:
Outer : for Arrays do
Inner : for Arrays do
print Cov (Inner.Item, Outer.Item)
-- This works
end
end
But how is it better than the construct we have started from?
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Return to the
comp.compilers page.
Search the
comp.compilers archives again.