Giter VIP home page Giter VIP logo

dart-lang / sdk Goto Github PK

View Code? Open in Web Editor NEW
9.8K 287.0 1.5K 1.33 GB

The Dart SDK, including the VM, dart2js, core libraries, and more.

Home Page: https://dart.dev

License: BSD 3-Clause "New" or "Revised" License

Python 0.80% JavaScript 0.15% Dart 82.64% HTML 0.44% Shell 0.07% Java 0.39% C++ 14.45% C 0.90% CSS 0.05% TeX 0.02% Batchfile 0.01% Makefile 0.01% GAP 0.03% Assembly 0.01% CMake 0.01% SCSS 0.01% Dockerfile 0.01% Objective-C++ 0.01% ANTLR 0.03%
dart language sdk programming-language

sdk's Introduction

Dart

An approachable, portable, and productive language for high-quality apps on any platform

Dart is:

  • Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.

  • Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.

  • Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.

Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:

  • Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.

  • Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).

Dart platforms illustration

License & patents

Dart is free and open source.

See LICENSE and PATENT_GRANT.

Using Dart

Visit dart.dev to learn more about the language, tools, and to find codelabs.

Browse pub.dev for more packages and libraries contributed by the community and the Dart team.

Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).

Building Dart

If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.

There are more documents on our wiki.

Contributing to Dart

The easiest way to contribute to Dart is to file issues.

You can also contribute patches, as described in Contributing.

Roadmap

Future plans for Dart are included in the combined Dart and Flutter roadmap on the Flutter wiki.

sdk's People

Contributors

a-siva avatar alexmarkov avatar bkonyi avatar bwilkerson avatar crelier avatar dantup avatar devoncarew avatar efortuna avatar floitschg avatar fsc8000 avatar jensjoha avatar johnmccutchan avatar johnniwinther avatar lrhn avatar mhausner avatar mkustermann avatar mraleph avatar munificent avatar nex3 avatar peter-ahe-google avatar pq avatar rakudrama avatar rmacnak-google avatar scheglov avatar sigmundch avatar srawlins avatar stereotype441 avatar vsmenon avatar whesse avatar zanderso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk's Issues

Generics disappear on try.dartlang.org

This issue was originally filed by [email protected]


Go to try.dartlang.org, then insert and execute this code:
class PointlessValueWrapper {
  PointlessValueWrapper(Type pointlessArgument);
}
main() {
  new PointlessValueWrapper(5);
  new PointlessValueWrapper("Hello!");
}

As expected, line 6 raises a warning.

Now, open the link on the top right in a new tab. You'll see the same code, except the type parameters are missing. Because of this, line 2 now produces an error.

I expect a tokeniser somewhere is misbehaving.

Using Firefox/Nightly (which is at version 10, at the moment).

Constructor Syntax

This issue was originally filed by [email protected]


I have an issue with the following:

class Point {
  var x, y;
  Point(this.x, this.y);
  scale(factor) => new Point(x*factor, y*factor);
  distance() => Math.sqrt(x*x + y*y);
}

The problem is that the constructor (in this case there's only one, but there may be many) includes the name of the class. This is (as far as I can tell) unnecessary duplication. Every time you rename a class, you need to change the name in multiple places.

I understand this could be solved by an IDE (which would do the work for you). However, simpler text editors have their place, too.

Please implement a different syntax, perhaps a 'new' keyword. I don't care what the exact syntax is, as long as there isn't unnecessary duplication.

Error in first online tutorial

This issue was originally filed by [email protected]


  1. Enter any 3 russian symbols instead of "World"
  2. Run.
  3. Program prints "Hello, хуй!"

хуй - russian dirty word. Do you have russian programmers? ;)

I'm using google chrome 14 to try this tutorial.
In some cases (when number of russian symbols is more then 3) it prints squares instead of letters (it's encoding problems i think ;)

Add currying

This issue was originally filed by [email protected]


Currying is a well-known (in functional languages) technique of transforming a function that takes multiple arguments (or an n-tuple of arguments) in such a way that it can be called as a chain of functions each with a single argument (partial application).

I propose to add its support into dart. Dart could implement them scala-way to keep both named / optional params and currying:

a = function(params1)(params2)(params3) {
  return params1 + params2 + params3
}

a(5)(6)(7)

Decide if we want to generate DivisionByZeroException errors

This issue was originally filed by [email protected]


Dart should not report a number divided by zero as infinity. And if infinity is allowed, math using infinity should be correct.

What steps will reproduce the problem?

  1. Use the following code:

main() {
  print(1 / 0);
  print((1 / 0) / (1 / 0));
}

What is the expected output? What do you see instead?

It should report:

NaN
NaN

Instead it reports:

Infinity
NaN

What version of the product are you using? On what operating system?

Using the following on Oct 10, 2011 15:50 EDT

http://www.dartlang.org/docs/getting-started/

Please provide any additional information below.

Not-implemented iteration for objects

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  main() {
    var obj = {"a": 1, "b": 2};
    for (var key in obj) {
      print(key);
    }
  }
http://try-dart-lang.appspot.com/s/EmEO

What is the expected output?
a
b

What do you see instead?
NoSuchMethodException - receiver: '' function name: 'iterator$named' arguments: []]

What version of the product are you using? On what operating system?
Online dart compiler.

Please provide any additional information below.

In the specification it says that "for in" construct is desugared into var n0 = e.iterator(); while (n0.hasNext()) { finalVarOrType id = n0.next();
It is not working because obj.iterator does not exist.

jQuery integration

This issue was originally filed by [email protected]


I may be mis-understanding dart, but I would like to put in a request that Google's engineers/someone smarter than me add jQuery as a possible library.

For instance, how would I accomplish the following using dart?

<pre>
$("p").click({function(){ alert("You clicked a paragraph tag!"); });
</pre>

Allow nested comments

Dart comments should nest. The language specification needs to be updated to that effect.

Process tests sometimes cause timeout on Linux

Either of the process tests

  ProcessExitTest.dart
  ProcessSegfaultTest.dart
  ProcessStartExceptionTest.dart
  ProcessStderrTest.dart
  ProcessStdoutTest.dart

can hang on Linux. It happens once every ~25 runs.

compile issue on Ubuntu 11.04 amd64

This issue was originally filed by [email protected]


compile issue on Ubuntu 11.04 amd64


cc1plus: warnings being treated as errors
runtime/vm/dart_api_impl.cc: In function ‘void* dart::Dart_CreateIsolate(void*, void*)’:
runtime/vm/dart_api_impl.cc:38:71: error: declaration of ‘void* dart::Dart_CreateIsolate(void*, void*)’ with C language linkage
runtime/include/dart_api.h:185:26: error: conflicts with previous declaration ‘void* Dart_CreateIsolate(const Dart_Snapshot*, void*)’
make: *** [out/Debug_ia32/obj.target/libdart_api/runtime/vm/dart_api_impl.o] Error 1

Can't build editor

This issue was originally filed by [email protected]


In editor/build/README.txt:


To begin, make sure the Dart plugin and feature sources are checked out from
SVN. Edit rcpinit.sh to define the location of the TRUNK directory that was
checked out. Also checkout the usage profile plugin and feature from perforce.
Define that directory in rcpinit.sh as GDT_PROF. You only the the usage
profiler, not all of GPE.


But google plugin for eclipse is not open-sourced yet:
http://code.google.com/eclipse/docs/faq.html#source

Where can I find smth like /src/prof-git5/google3/third_party/java/google_plugin_eclipse/opensource/trunk
for building editor?

Support for method overloading when using typed arguments

This issue was originally filed by [email protected]


I saw mention in documentation that Dart does not support method overloading because it is a dynamic language. However, Dart does support optional type annotations, which, as far as I can tell, opens the door slightly for the possibility of having method overloading when using typed argument values. I am proposing support for this behavior.

Currently when a programmer wants to support multiple types in a dynamic language using a single method, they will perform the instance checks manually as follows:

  class Displayer {
    void display(element) {
      if (element is String) { print(element); }
      else if (element is Image) { /* display image on screen */ }
      else { throw "Invalid argument"; }
    }
  }

This is cumbersome to the programmer and not easily translated in documentation-- not to mention easy to get wrong. Given support for optional types, I think we should be able to offload this dispatch to the compiler, which would make it much easier to write such methods.

For example, with overloading we could simplify the above snippet to:

  class Displayer {
    void display(String text) { print(text); }
    void display(Image image) { /* display image on screen */ }
  }

I am no compiler expert, but it seems plausible to me that given type annotations, a compiler could easily handle dispatching to the correct method at runtime. In addition, when cross-compiling to JS, the compiler could insert the manual checks as per the initial snippet above so that it would be equivalent to existing code that we see today. In fact, in the worst case, the Dart compiler could just always perform this translation directly in the method when it sees such an overload. That way there would not even be a need to modify the method dispatch rules in the VM-- it would simply be a completely transparent type check / dispatch that the user no longer has to do manually.

A couple of obvious restrictions on the functionality would be:

  1. Return types for overloaded methods would have to match. This is no different from other languages with overloading support, so nothing new here.
  2. All types would have to be declared on each variant when declaring an overloaded method. The compiler could easily check for this. I don't think users would be surprised by such an error if they ran into it-- seems intuitive enough.

All in all, this would be a great way to display the power of optional typing in the dynamic language world. It simplifies an idiom that is commonly used in dyn langs to circumvent the lack of overloading, and it would save developers from having to use separate method names depending on the input types. What do you think?

The example Fibonacci is not responsive most of the times

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. At dartland.org, choose the example Fibonacci.
  2. Instead of 20, as a parameter for the function Fib, use 50.

What is the expected output? What do you see instead?
I was expecting a numeric output generated by the function. Instead, the page freezes or crashes.

What version of the product are you using? On what operating system?
n/a. Google Chrome on Windows 7

Please provide any additional information below.

Include Open Sans Bold web font in dartlang.org pages

This issue was originally filed by [email protected]


The pages on dartlang.org use this tag to load Open Sans:

<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

This doesn't load the boldface file, while some parts like .intro > dl > dt are set in boldface. Currently this means that the regular font is made bold programmatically at these places, which looks very bad.

Instead, please use this tag:

<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>

Another typo in http://try-dart-lang.appspot.com/ code comments

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Visit http://try-dart-lang.appspot.com/

What is the expected output? What do you see instead?

In addition to issue20, I spotted another typo, marked with (sic) below.

The first or second "of" can be deleted, whichever you prefer :-)

"// Here you can try out the Dart Language from the comfort of of (sic) your own"

What version of the product are you using? On what operating system?

Above URL at the time of this issue submission.

Please provide any additional information below.

Troubling building in Mac OS X 10.7.1 Lion

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Download the source for everything or the standalone VM
  2. Run tools/build.py

What is the expected output? What do you see instead?

I expected Dart to build successfully. Instead, I get a generic error:

=== BUILD NATIVE TARGET libdart_vm OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
** BUILD FAILED **

What version of the product are you using? On what operating system?

Dart SVN
Mac OS X 10.7.1 Lion
gcc 4.2.1
Xcode 4.1

Please provide any additional information below.

$ cd runtime/
$ ../tools/build.py
xcodebuild -project dart-runtime.xcodeproj -target All -parallelizeTargets -configuration Debug_ia32 SYMROOT=/Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild
Build settings from command line:
    SYMROOT = /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild

=== BUILD AGGREGATE TARGET generate_corelib_cc_file OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
Check dependencies

PhaseScriptExecution "Action "generate_corelib_cc"" xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_cc_file.build/Script-61B70A4850462E150C53D7EB.sh
    cd /Users/andrew/Desktop/src/dart/dart/runtime
    /bin/sh -c /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_cc_file.build/Script-61B70A4850462E150C53D7EB.sh
note: Generating /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/DerivedSources/Debug_ia32/corelib_gen.cc file.

=== BUILD AGGREGATE TARGET generate_corelib_impl_cc_file OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
PhaseScriptExecution "Action "generate_corelib_impl_cc"" xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_impl_cc_file.build/Script-0F71A7DFBA54688A93AB479D.sh
    cd /Users/andrew/Desktop/src/dart/dart/runtime
    /bin/sh -c /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_impl_cc_file.build/Script-0F71A7DFBA54688A93AB479D.sh
note: Generating /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/DerivedSources/Debug_ia32/corelib_impl_gen.cc file.

=== BUILD NATIVE TARGET libdart_vm OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
** BUILD FAILED **

BUILD FAILED

Variables in single/double quotes.

This issue was originally filed by [email protected]


Can we use the PHP view that single quotes don't contain variables, but double quotes do... this may help the parser in speed, but more importantly it means the programmer doesn't have to check for and escape variables in single quoted strings.

Improved static type checking (strict mode?)

This issue was originally filed by [email protected]


Excerpt: http://www.dartlang.org/articles/optional-types/


   If you love types, you may use them everywhere, much like in a statically typed language. However, even then you won’t get the same level of static checking. Dart’s rules are much less rigid. We anticipate providing additional tools that might interpret type annotations more strictly for those who like that sort of thing.


Problem code:
    Object foo(){return "x";}
    String s = foo();

This type of 'relaxed' type checking makes the type system almost useless. If you're going to implement static type checking, then at no point should it be acceptable to take a return value of type 'Object' and implicitly assume it might be a 'String'.

I can completely get behind making types optional. This should be done via the Dynamic keyword. Even you remark that "new List();" is just a shorthand for "new List<Dynamic>();" I can agree with a return value of type 'Dynamic' being assigned to a 'String' type without an error/warning.

Acceptable:
    Dymanic foo(){ return "x";}
    String s= foo();

Please implement strict static type checking before people start writing libraries. This would greatly appease those of us "... who like that sort of thing".

dartc build failure: private DartNode.setParent()

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. build dart compiler

What is the expected output? What do you see instead?
dart/compiler/java/com/google/dart/compiler/ast/DartNode.java fails to compile with the following error:
    [javac] /data/down/devel/dart/dart/compiler/java/com/google/dart/compiler/ast/DartNode.java:122: error: setParent(DartNode) has private access in DartNode
    [javac] child.setParent(this);
    [javac] ^

What version of the product are you using? On what operating system?
dart svn, javac 1.7.0 on arch linux

Please provide any additional information below.
Making setParent() protected instead of private fixes the issue for me, allowing it to be called from protected method becomeParentOf() of the same class.

Support mixins

This issue was originally filed by [email protected]


Traits are interfaces on crack.

Really, it's what interfaces should have been. This would allow developers to code much less.
Traits doesn't have problems of multiple inheritance.

It would be great to have their support in dart. Something like

abstract class Person {
  Schedule schedule()
}
 
trait Student extends Person {
  private var classSchedule = ...
 
  schedule() => classSchedule
 
  learn() => ...
}
 
trait Worker extends Person {
  private var workSchedule = ...
 
  schedule => workSchedule
 
  work() => ...
}
 
class CollegeStudent extends Student with Worker {
  // ...
}

Building dart on Mac OS X Lion with xcode 4

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. checkout source code
  2. run tools/build.py

Result:
=== BUILD NATIVE TARGET v8_base OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===
** BUILD FAILED **

The problem is in macosx sdk version. Google Dart needs 10.5 for building, but there are no macosx10.5 sdk in XCode 4 in Lion.

Workaround: specify sdk manually in build.py:
Index: tools/build.py
===================================================================

--- tools/build.py (revision 296)
+++ tools/build.py (working copy)
@@ -106,6 +106,8 @­@
         if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
           project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName()
         args = ['xcodebuild',

  •            '-sdk',
    
  •            'macosx10.6',
    
                     '-project',
                     project_file,
                     '-target',

Full instruction for workaround on Lion:
http://batsuev.com/2011/10/building-google-dart-on-os-x-lion-with-xcode-4/

Build Failure for standalone VM

This issue was originally filed by [email protected]


What steps will reproduce the problem?
> Follow steps to build VM mentioned at http://code.google.com/p/dart/wiki/Building#Building_the_standalone_VM

What is the expected output? What do you see instead?
Build should be success, but it fails.

What version of the product are you using? On what operating system?
Latest version.

Please provide any additional information below.

Error output:
~/dart/runtime$ ../tools/build.py --arch=ia32
make -j 1 BUILDTYPE=Debug_ia32 all
  CXX(target) out/Debug_ia32/obj.target/libdart/runtime/vm/dart_api_impl.o
cc1plus: warnings being treated as errors
../runtime/vm/dart_api_impl.cc: In function ‘void* dart::Dart_CreateIsolate(void*, void*)’:
../runtime/vm/dart_api_impl.cc:38:71: error: declaration of ‘void* dart::Dart_CreateIsolate(void*, void*)’ with C language linkage
../runtime/include/dart_api.h:185:26: error: conflicts with previous declaration ‘void* Dart_CreateIsolate(const Dart_Snapshot*, void*)’
make: *** [out/Debug_ia32/obj.target/libdart/runtime/vm/dart_api_impl.o] Error 1
BUILD FAILED

Is this a known issue? or am I doing something wrong?

thanks,
swarup

Comparable Interface Should Include Comparison Operators

This issue was originally filed by [email protected]


The comparable interface should require implementation of the comparison operators. Given that Dart allows operator overloading, it is far more intuitive to write something along the lines of...

String a = 'aaa';
String b = 'bbb';

if (a < b) {
    print ('Hooray for operators!');
}

...than:

String a = 'aaa';
String b = 'bbb';

if ( a.compareTo(b) < 0) {
    // Whatever else.
}

This is not a huge deal, but to borrow a phrase from the Haskell wiki, it lowers the "semantic gap between the programmer's intention and the language".

Add Tau constant to core Math class

This issue was originally filed by [email protected]


With a new language, we are taking the opportunity to introduce better concepts, right? So please add Tau, the ratio of a circle's circumference to its radius (i.e. 2pi), to the Math class.

Leave Math.PI as is, but please add Math.TAU

This is a safe addition with no side effects and minimal impact to the language and runtime.

Tau manifesto: http://tauday.com/

Ctrl-Alt-R only works in http://www.dartlang.org/docs/getting-started/ when textarea has input focus

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Visit http://www.dartlang.org/docs/getting-started/
  2. Move pointer over the (|>) start button, notice callout "Run (Ctrl-Alt-R)"
  3. Press Ctrl-Alt-R and notice as nothing happens.
  4. Click in the source code textarea and notice how Ctrl-Alt-R now works.

What is the expected output? What do you see instead?

I expected the keyboard shortcut to work as advertized, without having to set focus in the textarea.

If this is not feasible, then the callout should only advertize the shortcut when applicable, i.e. focus is inside the textarea.

What version of the product are you using? On what operating system?

Above URL as of this issue submit time.

Please provide any additional information below.

Add C#-style extension methods

This issue was originally filed by [email protected]


Unless I'm reading the spec and examples wrong, it looks as if Dart uses the horrific Java approach of providing utility methods that operate on a interface, by putting them as static methods within some class with a name like 'Arrays' or 'Collections'. This is nonsense, especially when Linq and extension methods in C# have demonstrated a far superior approach, and Dart should provide an equivalent mechanism.

An obvious, easy way to add this would be that top level functions can optionally be called on an object using the dot operator, in which case the calling instance is passed as the first function parameter.

E.g. to write a generic first method that operates over an iterator for a supplied predicate:

T first<T>(Iterator<T> iterator, bool predicate(T obj)) {
    while (iterator.hasNext()) {
        if (predicate(iterator.next()) {
            return true;
        }
    }
    return false;
}

This could be called on an instance of an iterator as follows:

var jon = peopleIterator.first((p) => p.name == 'Jon');

Using extension methods that also return iterators, they can then chained together to form fluent expressions:

var fiveOldestJons = peopleInterator.where((p) => p.name == 'Jon').orderBy((p) => p.age).take(5);

It's worrying looking through the language design that you don't seem to looked much beyond JavaScript and Java for your inspiration in Dart. I can't speak for users of other languages, but I strongly doubt C# developers will be particularly impressed by a lot of the Java style anachronisms, and I'd urge you to cast your net a little more widely in general.

declaredIndentifier typos in Dart Language Specification, Draft Version 0.01, October 10th, 2011

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Open http://www.dartlang.org/docs/spec/dartLangSpec.pdf
  2. Search for "indent" (without the quotes)
  3. Notice how this should rather read ident instead.

What is the expected output? What do you see instead?

I see what must be a typo.

What version of the product are you using? On what operating system?

Dart Programming Language Specification
Draft Version 0.01
The Dart Team
October 10th, 2011

Please provide any additional information below.

Here is a copy/paste from the pdf (with the fi ligature manually reapaired). See my (sic) annotations for where I think the typos are:

11.9

Try

The try statement supports the definition of exception handling code in a struc-
tured way.

tryStatement:
try block (catchPart+ finallyPart? | finallyPart)
;

catchPart:
catch ‘(’ declaredIndentifier (sic) (‘, ’ declaredIndentifier (sic))? ‘)’ block
;

finallyPart:
finally block
;

Allowing null pointers is undesirable

This issue was originally filed by [email protected]


Short version: Null pointers are a really good way to mess up a program at runtime, and I'd like the Dart team to reevaluate whether they're absolutely required.

Slightly longer version: I would say the #­1 cause of issues in my programs (excluding logical errors/requirements errors) are NPEs. Having a language support NPE removal, be it via some clever compiler warning or simply removing null altogether, would be wonderful. I'm personally partial to Scala's method of null removal, but I'm sure PL gurus like yourselves have seen many others.

Dart has a stated goal of avoiding the creation of programs that "are difficult to debug or maintain." NPEs are a huge pain point in this regard. I'd be really happy if the Dart team reevaluated whether they are absolutely required to achieve the other aims.

Dart String toUpperCase and toLowerCase methods are incorrect for Turkish.

This issue was originally filed by @mdakin


String toLowerCase and toUpperCase does not work correctly for Turkish dotless i and capital dotted i.

Run this application (Unfortunately http://try-dart-lang.appspot.com/ loses Turkish characters after I tried to link it):

main() {

  // Expected conversions
  String trUpper = "A,B,C,Ç,D,E,F,G,Ğ,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z";
  String trLower = "a,b,c,ç,d,e,f,g,ğ,h,ı,i,j,k,l,m,n,o,ö,p,r,s,ş,t,u,ü,v,y,z";
  
  // Actual conversions
  String dartTrUpper = trLower.toUpperCase();
  String dartTrLower = trUpper.toLowerCase();
  
  if (dartTrUpper != trUpper) {
    print ("Incorrect Turkish toUpper conversion. \nExpected: ${trUpper} \nFound: ${dartTrUpper}");
  }
  if (dartTrLower != trLower) {
    print ("Incorrect Turkish toLower conversion. \nExpected: ${trLower} \nFound: ${dartTrLower}");
  }
}

Expected: Program does not print anything.
Actual: Prints 2 messages with outputs.

Support non-nullable types.

Admin comment: This is activaly being worked on, see dart-lang/language#110 and https://dart.dev/null-safety

This issue was originally filed by [email protected]


Short version: Null pointers are a really good way to mess up a program at runtime, and I'd like the Dart team to reevaluate whether they're absolutely required.

Slightly longer version: I would say the #­1 cause of issues in my programs (excluding logical errors/requirements errors) are NPEs. Having a language support NPE removal, be it via some clever compiler warning or simply removing null altogether, would be wonderful. I'm personally partial to Scala's method of null removal, but I'm sure PL gurus like yourselves have seen many others.

Dart has a stated goal of avoiding the creation of programs that "are difficult to debug or maintain." NPEs are a huge pain point in this regard. I'd be really happy if the Dart team reevaluated whether they are absolutely required to achieve the other aims.

Add Math.clamp

This issue was originally filed by [email protected]


Please add a function to the Math class that clamps a value between a minimum and a maximum, like so:

a = Math.clamp( a, -1, 1 );

This would behave identically to:

a = Math.max( -1, Math.min( 1, a ) );

"variable set but not used" error during build of VM

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. > Follow steps to build VM mentioned at http://code.google.com/p/dart/wiki/Building#Building_the_standalone_VM

What is the expected output? What do you see instead?
I get some "variable X set but not used"-type warnings, that -Werror escalates to errors, halting the build.
As a temporary measure, I removed -Werror from all *.mk files, which allows me to build the standalone VM successfully.

What version of the product are you using? On what operating system?
Recent svn on arch linux using gcc version 4.6.1 20110819 (prerelease)

Please provide any additional information below.
Here is a full list of the warnings (without -Werror and therefor not turned to errors)

third_party/v8/src/ia32/full-codegen-ia32.cc: In member function ‘virtual void v8::internal::FullCodeGenerator::VisitCompareOperation(v8::internal::CompareOperation*)’:
third_party/v8/src/ia32/full-codegen-ia32.cc:4085:12: warning: variable ‘strict’ set but not used [-Wunused-but-set-variable]
  CXX(host) out/Debug_ia32/obj.host/v8_base/third_party/v8/src/ia32/lithium-gap-resolver-ia32.o
third_party/v8/src/ia32/lithium-codegen-ia32.cc: In member function ‘void v8::internal::LCodeGen::DoLoadKeyedFastDoubleElement(v8::internal::LLoadKeyedFastDoubleElement*)’:
third_party/v8/src/ia32/lithium-codegen-ia32.cc:2235:12: warning: variable ‘elements’ set but not used [-Wunused-but-set-variable]
third_party/v8/src/ia32/lithium-codegen-ia32.cc: In member function ‘void v8::internal::LCodeGen::DoStoreKeyedFastDoubleElement(v8::internal::LStoreKeyedFastDoubleElement*)’:
third_party/v8/src/ia32/lithium-codegen-ia32.cc:3100:12: warning: variable ‘elements’ set but not used [-Wunused-but-set-variable]
third_party/v8/src/ia32/lithium-codegen-ia32.cc:3101:12: warning: variable ‘key’ set but not used [-Wunused-but-set-variable]

third_party/v8/src/ia32/full-codegen-ia32.cc: In member function ‘virtual void v8::internal::FullCodeGenerator::VisitCompareOperation(v8::internal::CompareOperation*)’:
third_party/v8/src/ia32/full-codegen-ia32.cc:4085:12: warning: variable ‘strict’ set but not used [-Wunused-but-set-variable]
  CXX(target) out/Debug_ia32/obj.target/v8_base/third_party/v8/src/ia32/lithium-gap-resolver-ia32.o
third_party/v8/src/ia32/lithium-codegen-ia32.cc: In member function ‘void v8::internal::LCodeGen::DoLoadKeyedFastDoubleElement(v8::internal::LLoadKeyedFastDoubleElement*)’:
third_party/v8/src/ia32/lithium-codegen-ia32.cc:2235:12: warning: variable ‘elements’ set but not used [-Wunused-but-set-variable]
third_party/v8/src/ia32/lithium-codegen-ia32.cc: In member function ‘void v8::internal::LCodeGen::DoStoreKeyedFastDoubleElement(v8::internal::LStoreKeyedFastDoubleElement*)’:
third_party/v8/src/ia32/lithium-codegen-ia32.cc:3100:12: warning: variable ‘elements’ set but not used [-Wunused-but-set-variable]
third_party/v8/src/ia32/lithium-codegen-ia32.cc:3101:12: warning: variable ‘key’ set but not used [-Wunused-but-set-variable]

Troubling building in Mac OS X 10.7.1 Lion

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Download the source for everything or the standalone VM
  2. Run tools/build.py

What is the expected output? What do you see instead?

I expected Dart to build successfully. Instead, I get a generic error:

=== BUILD NATIVE TARGET libdart_vm OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
** BUILD FAILED **

What version of the product are you using? On what operating system?

Dart SVN
Mac OS X 10.7.1 Lion
gcc 4.2.1
Xcode 4.1

Please provide any additional information below.

$ cd runtime/
$ ../tools/build.py
xcodebuild -project dart-runtime.xcodeproj -target All -parallelizeTargets -configuration Debug_ia32 SYMROOT=/Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild
Build settings from command line:
    SYMROOT = /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild

=== BUILD AGGREGATE TARGET generate_corelib_cc_file OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
Check dependencies

PhaseScriptExecution "Action "generate_corelib_cc"" xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_cc_file.build/Script-61B70A4850462E150C53D7EB.sh
    cd /Users/andrew/Desktop/src/dart/dart/runtime
    /bin/sh -c /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_cc_file.build/Script-61B70A4850462E150C53D7EB.sh
note: Generating /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/DerivedSources/Debug_ia32/corelib_gen.cc file.

=== BUILD AGGREGATE TARGET generate_corelib_impl_cc_file OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
PhaseScriptExecution "Action "generate_corelib_impl_cc"" xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_impl_cc_file.build/Script-0F71A7DFBA54688A93AB479D.sh
    cd /Users/andrew/Desktop/src/dart/dart/runtime
    /bin/sh -c /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/dart-runtime.build/Debug_ia32/generate_corelib_impl_cc_file.build/Script-0F71A7DFBA54688A93AB479D.sh
note: Generating /Users/andrew/Desktop/src/dart/dart/runtime/xcodebuild/DerivedSources/Debug_ia32/corelib_impl_gen.cc file.

=== BUILD NATIVE TARGET libdart_vm OF PROJECT dart-runtime WITH CONFIGURATION Debug_ia32 ===
** BUILD FAILED **

BUILD FAILED

Add "safe navigation"/existential operator

This issue was originally filed by [email protected]


I didn't find the "safe navigation"/existential operator in the specification. Please consider including something like what's available in

Coffeescript (http://jashkenas.github.com/coffee-script/#operators),

zip = lottery.drawWinner?().address?.zipcode

compiles to

    var zip, _ref;
    zip = typeof lottery.drawWinner === "function" ? (_ref = lottery.drawWinner().address) != null ? _ref.zipcode : void 0 : void 0;

Groovy (http://groovy.codehaus.org/Operators#Operators-SafeNavigationOperator%28%3F.%29)

The Safe Navigation operator is used to avoid a NullPointerException. Typically when you have a reference to an object you might need to verify that it is not null before accessing methods or properties of the object. To avoid this, the safe navigation operator will simply return null instead of throwing an exception, like so:

def user = User.find( "admin" ) //this might be null if 'admin' does not exist
def streetName = user?.address?.street //streetName will be null if user or user.address is null - no NPE thrown

Ruby, etc.

Null checks are tedious and clutter code-- really, anything is better than if( foo != null && ....)

Type checking is broken

This issue was originally filed by [email protected]


Use dartc_test to run:

bool foo(bool bar()) => bar();

bool bar() {}

main() {
  foo(bar);
}

with --enable_type_checks.

An error is thrown because the type of bar is not bool.

v8 compilation fixes for f16 (gcc 4.6.1)

This issue was originally filed by [email protected]


What steps will reproduce the problem?
1.try building on fedora 16
2.
3.

What is the expected output? What do you see instead?
A completed build of v8, instead it stops compilation at multiple spots because gcc is told to treat all warnings as errors.

What version of the product are you using? On what operating system?
latest dart, f16 x64

Please provide any additional information below.


Attachment:
dart_f16.diff (2.37 KB)

'--' typo in Dart Language Specification, Draft Version 0.01, October 10th, 2011

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Open http://www.dartlang.org/docs/spec/dartLangSpec.pdf
  2. Search for "++" (without the quotes)
  3. Notice the line below only has one '-' in front of 'e'

What is the expected output? What do you see instead?
The expect output should be "--"

What version of the product are you using? On what operating system?
Dart Programming Language Specification
Draft Version 0.01
The Dart Team
October 10th, 2011

Please provide any additional information below.
I think this is due to LaTeX shortening "--" to one hyphen. Try using -{}- instead

typo in initial example on try-dart-lang.appspot.com

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. Visit http://try-dart-lang.appspot.com/

What is the expected output? What do you see instead?

I expected to see coherent wording. Instead, I see "When you run the code … it it submitted to AppEngine". I believe the intended wording was "When you run the code, it is submitted to AppEngine".

What version of the product are you using? On what operating system?

The live version on Chrome and Fedora.

Please provide any additional information below.

Single-quotes should not allow string expansion

This issue was originally filed by [email protected]


It is a de facto standard, introduced with the shell and taken for granted in other languages that use dollar for expansion (PHP as the main example), that single quotes prevent all expansion.

The example:
  print('fib(20) = ${fib(20)}');
therefore exhibits an unconventional behavior in that it will expand the expression inside dollar-preceeded-brackets.

I would expect Dart to behave more conventionally by requiring double-quotes for inner string expansion, or single-quotes with concatenation.

Dart_Snapshot conflicting uses

This issue was originally filed by [email protected]


Trying to build Dart after clean checkout from SVN gives me :

runtime/vm/dart_api_impl.cc: In function ‘void* dart::Dart_CreateIsolate(void*, void*)’:
runtime/vm/dart_api_impl.cc:38:71: error: declaration of ‘void* dart::Dart_CreateIsolate(void*, void*)’ with C language linkage
runtime/include/dart_api.h:185:26: error: conflicts with previous declaration ‘void* Dart_CreateIsolate(const Dart_Snapshot*, void*)’

I ended up changing the dart_api_impl.cc declaration to use const Dart_Snapshot* and did a cast to (void*) in order to call Dart::CreateIsolate((void*)snapshot, data);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.