Commits

Gilad Bracha  committed e4b40bd

Trivial typo corrections in documentation.

  • Participants
  • Parent commits cb50972

Comments (0)

Files changed (2)

File Newspeak2DartCompilation.ns3

  mirrors: mirrors = NewspeakCompilation
  usingPlatform: platform
  asts: parsing ASTModule (
-(* Does the interesting work in Newspeak-to-Dart translation.
+(*Does the interesting work in Newspeak-to-Dart translation.
 
 Throughout this module, the type annotation <Node> means a Dart AST, a subclass of DartGeneration`Syntax`Node.
 
 
 NLR: Dart does not have non-local return; all return statements in nested functions are treated as local returns to the caller of that function rather than to the caller of the enclosing method. We simulate non-local return by wrapping method bodies in try-catch clauses that capture exceptions specific to a method's activation (not the method statically!) and rethrow all other exceptions. Unfortunately, VMs such as V8 or the Dart VM do not optimize methods containing a try, so we only wrap methods that actually contain a NLR to reduce the performance impact. Roughly 2% of Newspeak methods contain an NLR that cannot be inlined away.
 
-Built-in types: Numbers, booleans, closures, arrays and strings are represented directly by their Dart couterparts. In cases where the Newspeak and Dart APIs differ, we dispatch on an interceptor at each call site.
+Built-in types: Numbers, booleans, closures, arrays and strings are represented directly by their Dart counterparts. In cases where the Newspeak and Dart APIs differ, we dispatch on an interceptor at each call site.
 
 Implicit receiver sends: At compile-time, we determine whether an implicit receiver send is an outer send or a self send. If it is an outer send, we index into an array of enclosing objects. The index represents the lexical depth, with 0 being the immediately enclosing object. During mixin application, the enclosing objects array of the parent class is copied and prepended with the parent class.
 
 Copyright 2012 Google Inc.
 Copyright 2013 Ryan Macnak
 
-Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License.  You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0 *)|
+Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License.  You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0*)|
 	Dictionary = platform collections Dictionary.
 	OrderedCollection = platform collections OrderedCollection.
 	Set = platform collections Set.

File Newspeak2V8Compilation.ns3

 
 Newspeak closures map to Javascript functions. Accesses to self do *not* map directly to "this". Rather the receiver must be captured in a local at the beginning of a method, and access must be through this local to get proper lexical scope.
 
-[UNIMPLEMETED] This representation is not suitable for closure mirrors as there is no way in Javascript to get at the closure's free variables. To support closure mirrors, we would have create objects for each closure that took free variables and the enclosing context as arguments and stored them as slots that reflection could later access. dart2js follows this approach (but I believe this is to ensure they cannot be called with the wrong arity).
+[UNIMPLEMENTED] This representation is not suitable for closure mirrors as there is no way in Javascript to get at the closure's free variables. To support closure mirrors, we would have create objects for each closure that took free variables and the enclosing context as arguments and stored them as slots that reflection could later access. dart2js follows this approach (but I believe this is to ensure they cannot be called with the wrong arity).
 
 To implement #doesNotUnderstand:, for every message sent the compiler emits a DNU catcher that creates a Message object from the arguments and forwards to #doesNotUnderstand:. At bootstrap, these handlers are all installed into ImplementationBase.
 
 
 The basic types (number, array, block, boolean, string) are represented directly as their Javascript counterparts. Where the Javascript behavior differs from the Newspeak behavior, we monkey patch the Javascript prototypes.
 
-[ENGINEERING NOTE] These patches are all defined in classes of KernelForV8, using the js intrinsic described below. Unlike NS2JS, there is no need to look through several places and bootstrapping phases to find where such behavior is defined. Adding or modifying behavior for the basic types is as easier as adding or changing methods in these classes.
+[ENGINEERING NOTE] These patches are all defined in classes of KernelForV8, using the js intrinsic described below. Unlike NS2JS, there is no need to look through several places and bootstrapping phases to find where such behavior is defined. Adding or modifying behavior for the basic types is as easy as adding or changing methods in these classes.
 
-[PERFORMANCE NOTE] It is important that these patches are labelled for script mode to avoid automatic boxing.
+[PERFORMANCE NOTE] It is important that these patches are labelled for strict mode to avoid automatic boxing.
 
-[ENGINEERING NOTE] We simply label the whole program for script mode, but if our output got wrapped in or otherwise mixed with other scripts, it wouldn't run in script mode.
    1. Ministry of Truth repo owner

      Ok, I misunderstood the comment. I can rephrase it as:

      We simply label the whole program for strict mode. A potential problem is that if our output got wrapped in or otherwise mixed with other scripts, it wouldn't run in strict mode.

+[ENGINEERING NOTE] We could simply label the whole program for strict mode, but if our output got wrapped in or otherwise mixed with other scripts, it wouldn't run in strict mode.
 
 [ENGINEERING NOTE] dart2js does not use this technique because they want to interoperate with other Javascript code. Instead they use a technique called interceptors, and can avoid the cost in the common cast through fancy type inference and inlining that make runtime modification very difficult. Newspeak doesn't want to go there and is content to monkey patch.