Coder Social home page Coder Social logo

commonml's People

Contributors

andrewimm avatar bsansouci avatar chenglou avatar jordwalke avatar lkuper avatar sgrove 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

Watchers

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

commonml's Issues

Error formatter failed attempt report

Not sure if this is useful, but saw this file, thought I'd share it. Let me know if there's a better place to post this.

$ cat error_formatter_failed_attempts_commit_me_so_we_know_what_to_improve.txt
UNEXTRACTED_ERROR:s:_none_", line 1:
Error: Error while linking /Users/s/src/MyProject/_build_byte/MyProject/publicInnerModules/m_MyProject__MyPublicModule.cmo:
Reference to undefined global `Cohttp_lwt_unix'
UNEXTRACTED_ERROR:s:_none_", line 1:
Error: Error while linking /Users/s/.opam/system/lib/utop/utop.cma(UTop):
Reference to undefined global `Topfind'

TAPLArith fails with `unbound module "Lexer"`

MyProject builds fine though, but without any linebreaks in the output:

:~/clone/CommonML/ExampleProjects/MyProject$ ./_build_byte/MyProject/myProject.out

Inside of YourProject.YourProjectMod
Random number is smallerThanFourRandom number is biggerThanFourthis is a value from my internal utility modulemyUtilVal
Return String From testHelperFunction!

Shell is required to pick up opam environment

Not sure how to properly fix it, but having

"findlibPackages": [{"dependency": "js_of_ocaml"}]

gives me an error:

ocamlfind: Package `js_of_ocaml' not found
Dependencies scanned and verified, but failed to build

Stack Trace:
------------
 Error: Command failed: ocamlfind ocamldep  -package js_of_ocaml -only-show
ocamlfind: Package `js_of_ocaml' not found

    at checkExecSyncError (child_process.js:470:13)
    at Object.execSync (child_process.js:510:13)
    at getFindlibCommand (/home/ul/Projects/ludwig/node_modules/CommonML/build.js:1149:24)
    at discoverDeps (/home/ul/Projects/ludwig/node_modules/CommonML/build.js:1604:32)
    at dirtyDetectingBuilder (/home/ul/Projects/ludwig/node_modules/CommonML/build.js:2044:5)
    at onAllSubpackagesDone (/home/ul/Projects/ludwig/node_modules/CommonML/build.js:2266:11)
    at /home/ul/Projects/ludwig/node_modules/async/lib/async.js:52:16
    at replenish (/home/ul/Projects/ludwig/node_modules/async/lib/async.js:317:29)
    at /home/ul/Projects/ludwig/node_modules/async/lib/async.js:333:15
    at Object.async.forEachLimit.async.eachLimit (/home/ul/Projects/ludwig/node_modules/async/lib/async.js:226:35)

If I change

CommonML/build.js

Line 1148 in ccea57f

return child_process.execSync(findLib).toString().trim();
to

return child_process.execSync(findLib, {shell: "fish"}).toString().trim();

it picks up environment fine.

Probably worth to add shell as a config parameter to CommonML entry in package.json?

Getting started: package.json `name` must begin with a capital letter

Running through the README instructions, step 1:

https://github.com/jordwalke/CommonML#1-make-a-package-from-scratch

$ node -v
v5.1.0

$ node node_modules/CommonML/build.js

Building Root Package /Users/s/tmp/ocaml/MyProject [byte]

Scanning files from /Users/s/tmp/ocaml/MyProject

[ERROR] /Users/s/tmp/ocaml/MyProject/package.json:1 characters 0-0
Invalid package.json for undefined at /Users/s/tmp/ocaml/MyProject/package.json.
package.json `name` must begin with a capital letter.


Writing Package Errors: /Users/s/tmp/ocaml/MyProject/_build_byte/__packageDiagnostics.json
Dependencies scanned and verified, but failed to build

Stack Trace:
------------
 Error: ENOENT: no such file or directory, open '/Users/s/tmp/ocaml/MyProject/_build_byte/__packageDiagnostics.json'
    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.writeFileSync (fs.js:1224:33)
    at buildTree (/Users/s/tmp/ocaml/MyProject/node_modules/CommonML/build.js:2245:8)
    at whenVerifiedPath (/Users/s/tmp/ocaml/MyProject/node_modules/CommonML/build.js:2450:9)
    at Object.<anonymous> (/Users/s/tmp/ocaml/MyProject/node_modules/CommonML/build.js:2478:3)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)

Make with npmv3

npmv3 stores dependencies in a different way and I believe something breaks in CommonML - it would be easy to fix this, so we may as well.
(Bonus points for making "the location where dependency source code is stored" arbitrary, and configurable so we're not tied to npm).

Generate build script/Makefile that doesn't depend on node.

Most of the commands for building a project with CommonML are recorded into a simple list that can be dumped to a make file and executed without node.

There's only a couple of parts of CommonML that makes this difficult:

  • We currently discover the location of dependencies by executing a findlib command during the build process that uses execSync on the fly to get the exact location on the machine for certain libraries. Instead, you could imagine dumping to an environment variable in the script such as:
$LOC_OF_MY_DEPENDENCY=`findlib blah blah`
ocamlc  $LOC_OF_MY_DEPENDENCY/path/to/blah.cmo -o blah.exe

That would work because it doesn't require that the build.js actually ever receive the result of the findlib command.

  • build.js is geared towards local development so it assumes other CommonML dependencies are pulled down to a specific location node_modules. If distributing to opam (which is the primary use case for generating a node-free build script/Makefile), you don't even recompile your dependencies. In that case, you'd want the ability to have build.js have a special mode that doesn't search for dependencies' source in node_modules and doesn't recompile them, instead it needs to do something else to find the generated libraries/artifacts and their locations. If build.js just supported this mode regardless of if you're generating a node-free Makefile, then there's nothing special we'd have to do to support Makefile generation. Think of this mode as "promoting" your dependencies field to findLibDependencies.

If these could be fixed, then it would be much easier to generate a Makefile that does not rely at all on node. That means you could use CommonML for development, but then publish to opam a version of your package that can work regardless of if the client has node installed. (You would also need to generate a separate opam instal file, opam file and a bunch of other stuff, but that's fairly easy.).

Compile with reference;

How compile with reference to the Unix library?

Now when compiling get this error message:
File "none", line 1:
Error: No implementations provided for the following modules: Unix referenced from ./path

compile so:
node ./node_modules/CommonML/build.js --compiler=native

Package-dependent compiler flags

Adding {"dependency": "core"} to findlibPackages will cause failure in a build, because the package demands either the -threads or -vmthread flag. I added a bit of code to be able to group these kinds of flags with their dependencies:

    , "findlibPackages": [{"dependency": "lambdasoup"}
                          , {"dependency": "core"
                          ,  "compileFlags": [" -vmthread "]}
                          , {"dependency": "cohttp"}
                          , {"dependency": "cohttp.lwt"}
                          , {"dependency": "lwt"}]

I'm not 100% sure it's a great idea. I like the explicit nature of this, and if different packages have conflicting packages, it's easier to point out as an exception. But compiler flags feel like a higher-level concept than packages, so I'm not sure about it.

Confusing output; explicitly label legend?

As the second-to-last output, CommonML outputs:

☑ Rebuild Success ☒ Rebuild Failed ☐ Rebuild Blocked ⋯ Uninteresting

I kept thinking it was a place holder for the summary (summarizing the build graph above), took me several days of usage before I realized it was the legend for reading the build graph output.

make ocaml a typed javascript

Hi, this is a nice piece of work. Actually I am doing something that you might find interesting, I am adding a new javascript backend to ocaml https://github.com/bobzhang/ocaml/tree/master
Unlike js_of_ocaml, here I aim to produce readable javascript code, the output looks very promising:
http://zhanghongbo.me/js-demo
It already support most of the language(except missing some primitives, tailcall, currying, none of them is a blocking issue).
I think ocaml has a great potential to produce javascript code as good as typescript while having a sane type system.

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.