Coder Social home page Coder Social logo

Recover about cyber HOT 5 CLOSED

zachcp avatar zachcp commented on September 24, 2024
Recover

from cyber.

Comments (5)

fubark avatar fubark commented on September 24, 2024 2

Yes, you should be able to recover the stack trace for the implementation of recover. The current goal for libstd is to keep it small, and allow libs to be easily imported from the web... So one would do import json 'https://libs.com/json.cy'. But we could also keep an official set of modules in this repo. They would just be library modules that expose the interface with bindLib. There are a couple of things that needs to be done first though... one is user modules which I'm working on now. @matu3ba

from cyber.

zachcp avatar zachcp commented on September 24, 2024 1

Awesome! Thank you.

from cyber.

fubark avatar fubark commented on September 24, 2024

Hello @zachcp, I just fixed coreReadLine in 0c59964 to return a error(#EndOfStream) value when EOF is encountered. recover hasn't been implemented yet as the design hasn't been finalized. This issue can remain open as reminder to complete recover. I also wouldn't recommend using try right now outside of writing tests. Here's how you might handle the error:

for:
    line = readLine()
    if line == error(#EndOfStream):
        print 'end of stream'
        break
    else:
        print line`

from cyber.

matu3ba avatar matu3ba commented on September 24, 2024

Will this also work for use cases like this:

def runTest(da: dalib.Talib) -> int:
    st = da.expectEq(list(ta.storage_msg[0].keys())[0], "1")
    # This line feels very superfluous, but I need stack trace (without crashing) + dump program state
    if st != 0: da.failTestDumpState(st); return 1 
    st = ta.expectEq(list(ta.storage_msg[0].keys())[1], "2")
    if st != 0: da.failTestDumpState(st); return 1 # again feeling superfluous (2x time code size)
    # ...
    def failTestDumpState(self: object, status: int):
        print("FAIL with status:", status)
        traceback.print_stack() # printStackTrace
        self.dumpState()
        print("last_setEvState:", self.timeline_msg[self.dump_timeline_msg_last])
        print("Messages still in Queue:")
        while self.queue_msg.empty() == False:
            msg= self.queue_msg.get(block=False)
            writeQueueMsg(msg)
da = dalib.Dalib()
da.init()
st = runTest(da)
sys.exit(st)

?

If @fubark provides sufficient pointers on how libstd works, then I can start with libstd xml and json/dictionary functionality I dearly miss in python or is super clunky. This should also provide better insights into performance of realistic applications.

from cyber.

fubark avatar fubark commented on September 24, 2024

recover is no longer part of the language since Cyber has moved to a try/catch mechanism. Please open a new issue if anyone has trouble using it. Learn more about error handling here: https://fubark.github.io/cyber/docs/toc/errors/

from cyber.

Related Issues (20)

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.