Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 22:42
    rhuanjl synchronize #5885
  • Jan 31 2019 22:39
    MikeHolman synchronize #5923
  • Jan 31 2019 22:28
    MikeHolman synchronize #5923
  • Jan 31 2019 19:48
    MikeHolman synchronize #5923
  • Jan 31 2019 19:03
    penzn synchronize #5903
  • Jan 31 2019 17:15
    penzn synchronize #5903
  • Jan 30 2019 22:33
    wyrichte opened #5927
  • Jan 30 2019 22:33

    wyrichte on ADO_test

    Update ChakraCoreStatic.cpp (compare)

  • Jan 30 2019 22:32
    wyrichte closed #5916
  • Jan 30 2019 20:20
    MikeHolman synchronize #5923
  • Jan 30 2019 19:56
    MikeHolman synchronize #5923
  • Jan 30 2019 19:53
    MikeHolman synchronize #5923
  • Jan 30 2019 19:35

    wyrichte on Test-PR-webhook---don't-merge

    Update ChakraCoreStatic.cpp (compare)

  • Jan 30 2019 19:35
    wyrichte synchronize #5916
  • Jan 30 2019 19:07
    wyrichte synchronize #5925
  • Jan 30 2019 18:54

    wyrichte on Test-PR-webhook---don't-merge

    Update ChakraCoreStatic.cpp (compare)

  • Jan 30 2019 18:54
    wyrichte synchronize #5916
  • Jan 30 2019 18:12
    wyrichte closed #5926
  • Jan 30 2019 18:12
    wyrichte opened #5926
  • Jan 30 2019 01:43
    wyrichte synchronize #5925
Bruce Pascoe
@fatcerberus
Pulling the stack trace off an Error object was my first idea too, but wondered if there was a “sanctioned” solution
Jimmy Thomson
@MSLaguana
I'm not aware of one
There's also weirdness with this whole idea, like e.g. what would ["a.js", "b.js"].map(require) do? What is the "caller" of require there?
Bruce Pascoe
@fatcerberus
The other idea we had was to append a require() to the module source upon loading and let it be hoisted, but I didn’t like having the host see anything other than exactly what was typed in the text editor
Intuitively, I would want that resolved against the module calling .map
Jimmy Thomson
@MSLaguana
But in that case the direct caller is the library function implementing .map
And even if in this case we skip over internal library frames, the same issue could come up from shims or other things providing non-default library functionality
From an engine perspective, it's basically impossible to tell them apart I think, so the best way in my mind is to be specific and essentially bind the function to a particular context, e.g. specialize it for a given module
And yeah, I think the simplest way to do that is to do something like the commonjs approach where you inject a bit of code at the start
If you jam it all on one line, then it wouldn't impact user code much at all
But if they do put things on the first line (especially if it's minified) then that could be a pain
Ondrej Kelle
@tondrej
How about using JsSetModuleHostInfo with JsModuleHostInfo_HostDefined?
Ondrej Kelle
@tondrej
or maybe even with JsModuleHostInfo_Url
Bruce Pascoe
@fatcerberus
That’s not the problem - the problem is that I have no way to know which module was responsible for the require() call in the first place. If I did, then it would be trivial to pull the URL from it
But as @MSLaguana points out, higher-order functions complicate matters
Ondrej Kelle
@tondrej
@fatcerberus I see now, thanks.
Grahame Grieve
@grahamegrieve
If I try jsParseScript with an invalid script, I get back SyntaxError expected { - how can I get a line number for the error?
Bruce Pascoe
@fatcerberus
Read the .line property of the error object
Grahame Grieve
@grahamegrieve
where do I get the error object? i get an error code...?
Bruce Pascoe
@fatcerberus
Clearly you have a JS error object if you were able to read back “expected {“?
The error object is returned via result IIRC
If you string coerce it you only get the error message but you can read properties off it instead
It’s the same thing you would get back in JS for try { eval(invalid_code); } catch(err) { ... }
Grahame Grieve
@grahamegrieve
ok I think I follow that. Thank you for your patience
Grahame Grieve
@grahamegrieve
so I'm dense, or out of my depth here... I get what I think is the object you are talking about using JsGetAndClearException(obj). Using JsConvertValueToString/JsStringToPointer, I get the string I referred to above. So then I try to get the line property from it - using JsGetPropertyIdFromName and then JsGetProperty - and I get undefined for the value of the property.
Grahame Grieve
@grahamegrieve
no. I had to use JsCreatePropertyId instead of JsGetPropertyIdFromName. Why that is is not at all obvious from the documentation.
Ondrej Kelle
@tondrej
@grahamegrieve if you're using Pascal in chakracore-delphi you could pass the result of JsParse to ChakraCoreCheck which would raise an exception in your host app based on the error object, with properties like Line, Column, Source, URL.
Richard
@rhuanjl
JsGetPropertyIdFromName is marked as a windows only API because it expects a pointer to a row of char16 as the input string vs JsCreatePropertyId which takes a pointer to a row of char
Assuming you're using chakracore I generally would reccomend avoiding the APIs in ChakraCommonWindows.h; stick to the APIs in ChakraCommon.h and ChakraCore.h
Grahame Grieve
@grahamegrieve
well, I just switched to using your wrappers. Switching to the full code is a step too far for now
@tondrej
I'll try to stick to the non-windows API. But... do they solely differ by parameter type? or is there more to it?
Ondrej Kelle
@tondrej
@grahamegrieve Fair enough, then you might still benefit from using the ChakraCoreUtils unit which is just a very thin layer on top of the API, with some helper routines converting from/to some Pascal types and raising exceptions.
Ondrej Kelle
@tondrej
And it already has helpers to get properties by name or symbol, using none of the Windows-specific APIs.
Richard
@rhuanjl
there's nothing that needs the window's specific api unless you're using the chakra.dll which ships with windows rather than chakracore
Richard
@rhuanjl
the API seems perfectly usable without wrapper layers IMO though I guess if it saves you some time or if you're not working in C it may make sense
Ondrej Kelle
@tondrej
Thanks @rhuanjl - agreed! That's exactly the case here - the wrapper layers are only for convenience when using ChakraCore from Delphi or Free Pascal (not C).
CatCatCatDog
@CatCatCatDog
Guys, has anyone tried heap trace for ChakraCore? i mean, i want know where heap allocate with valgrind?
Bruce Pascoe
@fatcerberus
Valgrind requires you to compile CC using the --valgrind option—which is currently broken :(
Otherwise valgrind doesn’t like the 32GB address space reservation and suicides
“Out of memory”
CatCatCatDog
@CatCatCatDog
Ok, thanks
Bruce Pascoe
@fatcerberus
Static linking doesn’t currently work on Windows sadly :(
Jimmy Thomson
@MSLaguana
It's not supported at the moment, although someone did try it out and get it mostly working from what I recall. They did have to make some changes (a number of things happen on dll load, which will need to be changed for static linkage)
Jimmy Thomson
@MSLaguana
I don't recall the name of that person/project though, unfortunately
Richard
@rhuanjl
I think the working (though with some issues) static version of chakracore was part of this game engine project: https://github.com/Kode/Krom
nanjizal
@nanjizal
AdobeFlashMan, you may find https://github.com/Kode/openfl interesting, it's basically a minimal incomplete implemention of OpenFL implemented on top of Kha and potentially suitable for use with Krom. As you may know OpenFL is a Haxe implementation of the flash api and compiles both to c++ and js. Kha is more of a renderloop approach like say starling's renderTexture but cleaner. Kha code base is mixed js/c build but uses haxe ( or C++ ) for coding. Haxe is quite similar to as3 but arguably a better. Kha can target js or c++, it uses Krom as one possible target, I think it might be built into 'Kode Studio' a variant of Visual Code Studio and used for testing and debugging Kha and shaders. Anyway the way Kha uses Krom is with shaders recompiled ( https://github.com/Kode/krafix ) so there is no Dom support and it's purely a JS shader engine. I don't know anything about static linking etc... being more front end x-flash and now a haxe dev. But if your looking for a way to create applications and games with ChakraCore then Kha is definitely an option, if your used to Flash then you will find the text support good but very low level. For GPU graphics it's much cleaner simpler than flash stage3d and starling and allows many workflows perhaps look and Armory3d and the core library Iron as one possible approach.
sorry my grammer is not ideal.
Grahame Grieve
@grahamegrieve
is there anyway I can mark an object as immutable? so that you can't assign to properties on it?
this applies to both to objects I pass into the javascript engine, and some objects created by the javascript code