Skip to content
This repository has been archived by the owner on Aug 10, 2020. It is now read-only.

Sys.argv, Sys.max_array_length, Sys.max_string_length are working #59

Open
wants to merge 1 commit into
base: source
Choose a base branch
from

Conversation

MoOx
Copy link
Contributor

@MoOx MoOx commented Jun 5, 2018

I tried this

Js.log(Sys.argv);

Js.log(Sys.max_array_length);

Js.log(Sys.max_string_length);

(compiled to)

// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE
'use strict';

var Sys = require("bs-platform/lib/js/sys.js");

console.log(Sys.argv);

console.log(Sys.max_array_length);

console.log(Sys.max_string_length);

/*  Not a pure module */

And got this

❯ ./index.js lol
[ '/Users/MoOx/.nvs/node/8.11.1/x64/bin/node',
  '/Users/MoOx/Sync/Development/git-init/index.js',
  'lol' ]
2147483647
2147483647

(index.js import my Module.re via .bs.js suffix)

I tried this

```re
Js.log(Sys.argv);

Js.log(Sys.max_array_length);

Js.log(Sys.max_string_length);
```

(compiled to)

```js
// Generated by BUCKLESCRIPT VERSION 3.1.5, PLEASE EDIT WITH CARE
'use strict';

var Sys = require("bs-platform/lib/js/sys.js");

console.log(Sys.argv);

console.log(Sys.max_array_length);

console.log(Sys.max_string_length);

/*  Not a pure module */

```

And got this

```
❯ ./index.js lol
[ '/Users/MoOx/.nvs/node/8.11.1/x64/bin/node',
  '/Users/MoOx/Sync/Development/git-init/index.js',
  'lol' ]
2147483647
2147483647
```

(index.js import my Module.re via .bs.js suffix)
@@ -46,10 +46,6 @@ BuckleScript uses the same algorithm as native OCaml, but the output is differen

Not supported yet.

## Sys.argv, Sys.max_array_length, Sys.max_string_length

Command line arguments are always empty. This might be fixed in the future. `Sys.max_array_length` and `Sys.max_string_length` will be the same as `max_int`, but it might be respected.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should only have removed Sys.argv?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thing is such configuration does not sound very meaningful in js context

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, should this be merged?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure how to interpret "it might be respected". The max seems to be respected, currently. For example, trying to create a string with String.make(Sys.max_string_length + 1, 'c'); overflows and throws an exception Invalid_argument,-3,String.create. At least the part about Sys.argv could be removed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants