Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Brian Shirai
@brixen
hm, in fact, ByteBuffer won't have a #to_s or #to_str method on it
rather, String will have a constructor that takes a ByteBuffer
Brian Shirai
@brixen
I think I can use ByteBuffer to work on the new register instructions for indexed objects (eg byte[])
looking at how to introduce attributes to classes
of course, the Ruby-ish way would be a class method, something like:
class A
  # Option 1: this permits various options for a specific attribute
  attributes immutable: true, concurrent: true

  # Option 2: this presumes all attributes are boolean
  attributes :immutable, :concurrent

  # Option 3: mix 1 & 2
  attributes :immutable, concurrent: [:read, :write]
end
Brian Shirai
@brixen
but I was thinking about something slightly different, like this:
# the 'method' scoping A would be a compiler pragma
class attributes(:immutable, :concurrent)::A
end

# this works with arbitrary class paths by inserting before the class or module being created
class A::B::attributes(:immutable)::C
end
this would allow "accumulating" attributes as classes are re-opened, but would not be able to unset attributes (eg immutable) that disallow it
it would be an interesting way to, for example, re-open Array in your program and add concurrent attribute
either syntax could allow this actually, but the 2nd form allows the compiler to know this before any code executes in the class/module body, which probably has advantages
also, this would avoid any name clashes because the attribute identifier wouldn't be in any identifier scope (eg variable, method)
Brian Shirai
@brixen
@chuckremes @ljulliar thoughts on that?
hmm, I could use the same mechanism to create a way to make data types, but the syntax would be a little weird:
class type()::V
  x: int
  y: int

  fun norm()
    sqrt(x**2 + y**2)
  end
end
Brian Shirai
@brixen
maybe I really should start that way because making data or type a keyword is gonna break lots of stuff :frowning:
Laurent Julliard
@ljulliar
Like @chuckremes I like the idea of a String possibly becoming mutable (btw I don't know if it's relevant in any way here but I think I read that in the last release of Rudt they tried to relax somehow the way variables can become mutable). There has to be some flexibility here. As for the syntax I personally far prefer the use of attributes which btw is ablso amenable to other evolution like static type declaration without having to change the syntax of Ruby. Like in attr_type my_attr: :String, my_other_attr: :Circle. This is what I opted for in Rlang.
Brian Shirai
@brixen
@ljulliar which attributes, the module method or the compiler pragma in the constant path?
also, not sure if you saw my examples for types in the README, but thoughts on that?
Laurent Julliard
@ljulliar
I meant the module methods
Brian Shirai
@brixen
ah yeah, they are very Ruby-ish, but easy to conflict with other code and there's no restrictions on where they are placed, which means you could start defining methods that have mutating bytecodes and then say attributes :immutable, for example
leaning more towards compiler pragmas, but I haven't implemented anything yet
Ruby doesn't have syntax for decorators but the path "method"-like syntax would function something like a decorator
what I really need to do is finish the PEG instructions and get started on a new parser
couple great videos, one very old, one brand new...
Laurent Julliard
@ljulliar
@brixen you are right: those statements are position depedent. I agree that this is quite unusual in Ruby but it is already the case for statements such as public and private that are also position dependent. One of the other advantage of this approach is that you can easily make it backward compatible by defining module methods possibly fake ones doing nothing by the way and keep your code running in older non-typed version of Ruby
Brian Shirai
@brixen
that’s the beauty of those compiler pragmas, they are normal syntax and could be no-op methods
So everything is equivalent for those considerations
Laurent Julliard
@ljulliar
Ah yes. That's right.
Chuck Remes
@chuckremes
@brixen ping… John Day emailed me this morning asking about you
said he emailed you at brian -at- rubinius.com a while ago but hasn’t heard back
so, just checking in
Brian Shirai
@brixen
Oh hey! Thanks, I’ll check my email 🤣
@chuckremes how have you been?
Chuck Remes
@chuckremes
i’ve been good
working from home for 4 months now… turned a spare bedroom into an office so i’m pretty comfortable now
wish i had time for hobby stuff… work is busier than ever and, well, i need the $$ :)
the only rina work i’ve done lately is commenting on Day’s new white papers… interesting stuff, but i’d like to code
how are you?
Brian Shirai
@brixen
@chuckremes working from home, no space for an office so navigating a loud cat and rambunctious 7 yr old who believes she doesn't have to do any school work every day while probably a solid 4 hrs of meetings, too much fun to recount :laughing:
I'd love to read Day's new white papers, I'll have to make some time for that
Brian Shirai
@brixen
spent hours today trying to get Linux installed on a ~2008 MacBook, which has 32bit EFI but 64bit core 2 duo, so it's not possible to just use a 64bit distro iso without futzing with the bootloader :( finally got a recent version of ElementaryOS installed (which is pretty nice), but either it's very unstable or is constantly hitting swap because it locks up constantly
it's pretty wild how nasty hardware like this still is, why isn't this stuff so much easier?
sunwoo2
@sunwoo2
Hello, I'm a junior developer. I've been trying for weeks to compile Ruby code into machine code. At present, I got a bytecode. I tried many ways, but I couldn't. How can i get a machine code from rubinius?
my rubinius version is 5.0 in ubuntu 18.04
Chuck Remes
@chuckremes
Ask this in Rubinius/Rubinius-languages. There’s some work there to emit web Assembly from Rubinius which will likely answer your questions.
Brian Shirai
@brixen
@sunwoo2 there's not a way to generate machine code right now, but if you're interested in working on that, I can help you get started. What are you interested in doing with Rubinius?
sunwoo2
@sunwoo2
I see. What I do these days is disassembling whether a object file or binary file(executable file) of C with objdump in ubuntu to get the assembly code. Also I want to do it in python and ruby. I almost did it with 'pyinstaller' in python, an interpreter similar to ruby. Thus I tried to do it with rubinius. Is there any way compile ruby code? In addition, How can I recognize jit compilation at runtime in rubinius? If so, where is the compiled code?
Brian Shirai
@brixen
@sunwoo2 there's no JIT to machine code right now, but if you want to build version 3.19, you can play with the previous JIT. Both the previous JIT and the new one will compile a bytecode sequence to machine code, but where the previous JIT used hand coded LLVM IR, the new one will use the instruction functions directly. What's your interest in dissassembling Ruby code? Usually the source code is available, unlike with C obj files
sunwoo2
@sunwoo2
Thank you for your answer!! it helped me understand Rubinius. I'll do something about it.
Zak Storer
@zacts
hello Rubinius
Brian Shirai
@brixen
👋