Discussion:
[dart-misc] Kernel lang
kc
2017-02-21 16:05:45 UTC
Permalink
In kernel lang there seem to be separate constructs for while/for/do.

How about just one loop construct with pre and post blocks. Annotations on
the loop node would indicate which type of loop it was.
More abstract but would make it easier to introduce new syntax or even
experiment with DSL's.

Same goes for conditionals.

K.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Florian Loitsch' via Dart Misc
2017-02-21 17:31:52 UTC
Permalink
[+kmillikin, asgerf]


On Tue, Feb 21, 2017 at 5:05 PM kc <***@gmail.com> wrote:

In kernel lang there seem to be separate constructs for while/for/do.

How about just one loop construct with pre and post blocks. Annotations on
the loop node would indicate which type of loop it was.
More abstract but would make it easier to introduce new syntax or even
experiment with DSL's.

Same goes for conditionals.

K.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to misc+***@dartlang.org.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Lasse R.H. Nielsen' via Dart Misc
2017-02-21 18:15:11 UTC
Permalink
(I have no idea why the current design was made, the following is purely
speculation).

One argument against unifying the loops is that it might make compilation
to JavaScript harder. If you can unify the loops in such a way that you
don't lose information, then it should be possible (at least in some cases)
to compile a do-while loop in Dart to a do-while loop in JavaScript.
If you throw away the information that the original was a do-while loop,
then you basically have to re-discover that information again later to do
an optimal compilation.


/L


On Tue, Feb 21, 2017 at 6:31 PM, 'Florian Loitsch' via Dart Misc <
Post by 'Florian Loitsch' via Dart Misc
[+kmillikin, asgerf]
In kernel lang there seem to be separate constructs for while/for/do.
How about just one loop construct with pre and post blocks. Annotations on
the loop node would indicate which type of loop it was.
More abstract but would make it easier to introduce new syntax or even
experiment with DSL's.
Same goes for conditionals.
K.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
Lasse R.H. Nielsen - ***@google.com
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Kevin Millikin' via Dart Misc
2017-02-22 10:06:30 UTC
Permalink
Kernel is a high-level core language for a Dart runtime, so it has Dart
semantics. We kept for and while loops separate partly because for has
different rules for variable capture than while.

We don't intend to require a Kernel (Dart) runtime to support behavior that
isn't required for implementing Dart. You already have quite a lot of
flexibility in the IR if you confine yourself to while (true) and break.
Post by 'Lasse R.H. Nielsen' via Dart Misc
(I have no idea why the current design was made, the following is purely
speculation).
One argument against unifying the loops is that it might make compilation
to JavaScript harder. If you can unify the loops in such a way that you
don't lose information, then it should be possible (at least in some cases)
to compile a do-while loop in Dart to a do-while loop in JavaScript.
If you throw away the information that the original was a do-while loop,
then you basically have to re-discover that information again later to do
an optimal compilation.
/L
On Tue, Feb 21, 2017 at 6:31 PM, 'Florian Loitsch' via Dart Misc <
[+kmillikin, asgerf]
In kernel lang there seem to be separate constructs for while/for/do.
How about just one loop construct with pre and post blocks. Annotations on
the loop node would indicate which type of loop it was.
More abstract but would make it easier to introduce new syntax or even
experiment with DSL's.
Same goes for conditionals.
K.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 KÞbenhavn K
- Denmark - CVR nr. 28 86 69 84
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...