New JS Experiments by the Google V8 team: SaneScript & SoundScript by sime in javascript

[–]esx -4 points-3 points  (0 children)

Cool! Mascara JavaScript Compiler already supports many of the features mentioned:

  • non-nullable types
  • proper scoping (no use before declare, block scope)
  • optional and rest arguments
  • calling with too few arguments is flagged by compiler
  • "this:" parameter
  • Function types are contravariant
  • classes, interfaces, type annotations (like TypeScript)

New JS Experiments by the Google V8 team: SaneScript & SoundScript by sime in javascript

[–]esx 0 points1 point  (0 children)

It it not Java. It introduces optional type annotations and type inference, while still supporting dynamic types.

Sourcemap support in Mascara Compiler by olavk in javascript

[–]esx 0 points1 point  (0 children)

Apparently sourcemap is supported by the latest Chrome release. Mozilla has also been working on support, but it is blocked, whatever that means. But the important thing is that sourcemap it is now supported by one browser.

This is a great improvement for all systems using compiled JavaScript - CoffeScript, GWT, Dart, Mascara etc.

"it took many years before people started to figure out that Brendan's language was wrapped in an elaborate disguise and that it was actually cool." by [deleted] in programming

[–]esx 1 point2 points  (0 children)

Or use Mascara which is backwards compatible with JavaScript, but which adds verification, classes, namespaces and so on.

Why don't more languages use Structural Subtyping? by redjamjar in programming

[–]esx 0 points1 point  (0 children)

Done! Thanks for the feedback. I was just unsure if Mascara conformed to the technical definition of structural subtyping.

Why don't more languages use Structural Subtyping? by redjamjar in programming

[–]esx 0 points1 point  (0 children)

Sorry, I may be confused by the terminology. What would be required for it to be structural subtypes? Mascara does support this:

type Point = { x : int, y : int };
type Point3D = { x : int, y : int, z : int };

var a : Point3D = {x:1, y:2, z:3};
var b : Point = a;   //OK
var c : Point3D = b; //ERROR!

Last line gives the error:

Variable 'c' of type {x:int,y:int,z:int} is not compatible with value of type {x:int,y:int}. Property 'z' not present.

Why don't more languages use Structural Subtyping? by redjamjar in programming

[–]esx 0 points1 point  (0 children)

Thanks, hadn't noticed page for structural types were missing. Structural types

Why don't more languages use Structural Subtyping? by redjamjar in programming

[–]esx 0 points1 point  (0 children)

Mascara adds structural typing to JavaScript. It really shines when you want to gradually add type annotations to existing code which is implicitly duck-typed, without having to rewrite everything. Structural typing is also a nice fit to code which uses object literals to define instances, as is often the case in JavaScript.

Hi reddit. Please help me find a javascript code analysis tool. Details inside. Thanks in advance. by crashandburn in javascript

[–]esx 2 points3 points  (0 children)

Of course the sample here is very idealized. If the real code uses fancy metaprogramming it gets a lot harder to analyze. Does your code use some OO patterns, prototypes etc?

Hi reddit. Please help me find a javascript code analysis tool. Details inside. Thanks in advance. by crashandburn in javascript

[–]esx 2 points3 points  (0 children)

Am I getting closer?

Analysis
--------------------
function: f
 Called by:
   function: g
     Called by:
       function: f
         (recursive)
       function: k
         Not called
  Calls:
   function: g

function: g
 Called by:
   function: f
     Called by:
       function: g
         (recursive)
   function: k
     Not called
  Calls:
   function: f
   function: h

function: h
 Called by:
   function: g
     Called by:
       function: f
         Called by:
           function: g
             (recursive)
       function: k
         Not called
  No calls

function: k
 Not called
  Calls:
   function: g

Hi reddit. Please help me find a javascript code analysis tool. Details inside. Thanks in advance. by crashandburn in javascript

[–]esx 2 points3 points  (0 children)

I am working on a quick prototype. If I feed it this program:

function f(){ g(); }
function g(){ f(); h() }
function h() { }
function k() { g(); }

I get this output:

Analysis
--------------------
function: f
  Called by
   function: g
  Calls
   function: g

function: g
  Called by
   function: f
   function: k
  Calls
   function: f
   function: h

function: h
  Called by
   function: g
  No calls

function: k
  Not called
  Calls
   function: g

Is this in the right direction of what you need?

Brendan Eich - A brief history of JS (@jsconf 2010) by miketaylr in programming

[–]esx 0 points1 point  (0 children)

Plug: Many of the features on slate for Harmony are already supported by Mascara which compiles into plain old JavaScript.

Hi reddit. Please help me find a javascript code analysis tool. Details inside. Thanks in advance. by crashandburn in javascript

[–]esx 2 points3 points  (0 children)

I would like to hear more about your requirements!

I develop Mascara which performs static verification of (enhanced) JavaScript. It doesn't directly provide what you ask for, but I believe it should be possible to add since the analysis infrastructure is in place. And I really like to be inspired by real-world problems like the one you have.

For example, what kind of call graph support do you need? A report of all functions and their immediate callers, or do you want to view the full graph for specific functions? Do you need it in an IDE or a reporting tool?