Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    M. Mert Yıldıran
    @mertyildiran
    By the way, I've fixed the issue on Windows with chaos-lang/fs@eceb601
    Noah Altunian
    @naltun
    Nice 👍.
    Noah Altunian
    @naltun
    Morning @mertyildiran. Question: do you prefer squash merging?
    Oh! It's the 1 year birthday of Chaos, correct?
    Noah Altunian
    @naltun

    Also, I'm sitting on this branch: https://github.com/chaos-lang/fs/tree/rename

    I don't want to merge it before I get a test in. How do we go about testing?

    Noah Altunian
    @naltun
    I also just had a thought: the new fs spell was supposed to be for filesystems, but it so far seems to only be manipulating files. Question: should we change this to the file or fileutils spell?
    Python has these modules for manipulating files/directories (paths):
    image.png
    And the fs spell seems to be a bit more of the os/sys Python modules. At least in intent.
    The fs API currently supports: read(), copy(), and soon-to-be rename(), all related to files.
    Thoughts?
    M. Mert Yıldıran
    @mertyildiran

    Morning @mertyildiran. Question: do you prefer squash merging?

    I prefer linear history with as little squash and merge commits as possible because of this email of Linus: https://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html

    If something really needs a squash then at list this method should be used: https://stackoverflow.com/a/5190323/2104879

    Oh! It's the 1 year birthday of Chaos, correct?

    I didn't know that today is the birthday of Chaos :smile: How did you determine that? Looked at the first ever commit?

    Also, I'm sitting on this branch: https://github.com/chaos-lang/fs/tree/rename

    I don't want to merge it before I get a test in. How do we go about testing?

    I expect to have tests for each functions in the library in https://github.com/chaos-lang/fs/blob/44329743f33953dcb51cb6a65f6b1deaad0f8f2c/test.kaos

    Noah Altunian
    @naltun

    :smile: How did you determine that?

    I saw your LinkedIn had the start-month of your volunteer on the project as Dec '19. I don't know the day, but the month? ; ) So this requires a big congrats, right?

    This message was deleted
    We're almost there: Dec 21, 2019 is the birthday of Chaos. And you know, that's a very good day for a birthday.
    M. Mert Yıldıran
    @mertyildiran
    Yeah, I've looked at the first ever commit and it's Date: Sat Dec 21 21:55:22 2019 +0300. But sure we can do an early celebration.
    Yep.
    Noah Altunian
    @naltun
    I think you saw my comments before I deleted them (before checking)
    hehe
    M. Mert Yıldıran
    @mertyildiran
    Yes :smile:
    Noah Altunian
    @naltun
    But this is cool. Dec 21
    This message was deleted
    M. Mert Yıldıran
    @mertyildiran

    I also just had a thought: the new fs spell was supposed to be for filesystems, but it so far seems to only be manipulating files. Question: should we change this to the file or fileutils spell?

    Python's modules related to file manipulation is a little bit messy. They've introduced more modules and kept the old modules along the way for the sake of backward compatibility. Since even the core modules requires separate installation procedure in Chaos, if we split the modules then it might become a little bit inconvenient to use them. I would go with a relatively big module that covers everything related to filesystem. fs is a good name for such a module I think.

    M. Mert Yıldıran
    @mertyildiran
    All core modules should hide/abstract OS-specific issues as much as possible so that users will not have to deal with them. We will still need an os module to retrieve operating system's kernel name/version and distro name/version etc. We can have modules like linux, windows and macos to provide OS-specific functionality if it's really needed.

    The fs API currently supports: read(), copy(), and soon-to-be rename(), all related to files.

    If rename() function is able to do more than just file renaming like changing the path then I think move() name is more suitable.

    Noah Altunian
    @naltun
    Great feedback.
    I'll consider this when adding/refactoring fs.
    M. Mert Yıldıran
    @mertyildiran
    I think we need fs.open() and fs.close() functions such that fs.open() returns the file pointer and we pass that file pointer to fs.read() and fs.write().
    But Chaos language does not have any built-in data type to store a file pointer or any pointer at all. We can return it as a string like str file_pointer = fs.open(some_path) but it would be a bad approach.
    I think instead we should introduce a new primitive data type named byte to the language and it will be prefixed with an integer like 1 byte, 2 byte etc. So that we can have the file pointer like 1 byte file_pointer = fs.open(some_path).
    M. Mert Yıldıran
    @mertyildiran
    On a second thought, prefixing it with an integer might introduce weird challenges in the implementation. Alternatively we can do: DD, DB, DW, DQ, DT just like how it's in Assembly. But I think 1 byte is cooler.
    Would you like to add such a data type into language's source?
    Actually sys_open syscall returns a file descriptor but in its essence it's a 1 byte pointer as far as I understand from this Assembly code example for file operations. I might be wrong though.
    Noah Altunian
    @naltun
    I'd love to. I'll have to review some things, but I'd like to give it a try.
    Let me revisit these points this evening.
    M. Mert Yıldıran
    @mertyildiran
    Sure, it's great to hear that! You can follow the path using a data type token num token name T_VAR_NUMBER by following:
    lexer.l > parser.y > ast.c > interpreter/
                                    > symbol.c
                                    > function.c
                                    > interpreter.c
                                > compiler.c
                                > Chaos.c
    M. Mert Yıldıran
    @mertyildiran
    Here is a simple recipe to add a new data type:
    • Add token to lexer.l
    • Add parsing rules to parser.y
    • Add AST node types to enum ASTNodeType in ast.h and char *ast_node_type_names[] in ast.c
    • Add a value type (pointer/byte) to union Value in symbol.h
    • Add a function to set byte type value in ast.c and use them in parser.y
    • Implement the related functions in symbol.c
    • Add support for new data type into function.c
    • Add case statements into interpreter.c for the AST node types that you've introduced.
    • Add case statements into compiler.c for the AST node types that you've introduced.
    • Implement the functions in Chaos.c to provide an API to Chaos C extensions for the new data type.
    I would try to go with 1 byte, 2 byte syntax to see how possible it's.
    Noah Altunian
    @naltun
    200 "&"                             {return T_BITWISE_AND;}
    201 "|"                             {return T_BITWISE_OR;}
    202 "^"                             {return T_BITWISE_XOR;}
    203 "~"                             {return T_BITWISE_NOT;}
    204 "<<"                            {return T_BITWISE_LEFT_SHIFT;}
    205 ">>"                            {return T_BITWISE_RIGHT_SHIFT;}
    Pleasant surprise to see these already!
    M. Mert Yıldıran
    @mertyildiran
    Yes, the bitwise operators are also valid for integers in C so I've added the support for them in the past.
    Noah Altunian
    @naltun
    Mert, it must be super late where you are.
    :P But I'm also an early riser, too.

    the bitwise operators are also valid for integers in C

    Great

    M. Mert Yıldıran
    @mertyildiran
    :smile: yes I'm a night owl
    I don't know if it's possible to have a generic pointer that covers FILE* but after finding that you'll essentially add it to this union to have a new data type.
    M. Mert Yıldıran
    @mertyildiran
    Please let me know if you stuck somewhere in the language's source. Since some parts of the codebase are not so self-explanatory.
    Noah Altunian
    @naltun
    I'm going to put my computer down for the evening, but I will give this a fresh look at some point tomorrow. I will reach out with any questions then.
    Noah Altunian
    @naltun
    Have a good day, enjoy the early morning ;)