GithubHelp home page GithubHelp logo

Document CStruct vs CStructEntity about fiddle HOT 6 CLOSED

ruby avatar ruby commented on August 22, 2024
Document CStruct vs CStructEntity

from fiddle.

Comments (6)

kou avatar kou commented on August 22, 2024

I don't understand the real reason for CStruct and CStructEntity because I'm not the create of CStruct.
But I think that the creator wants to avoid class CUnion < CStruct inheritance.

They exist for backward compatibility of DL (ruby-dl2): https://github.com/ruby/ruby/blob/ruby_2_1/ext/dl/lib/dl/struct.rb

ruby-dl uses Struct and Union directly and class Union < Struct: https://github.com/ruby/ruby/blob/ruby_1_8_7/ext/dl/lib/dl/struct.rb

Anyway, we'll be able to improve them with keeping backward compatibility.

Normal users will use Fiddle::Importer.struct instead of using Fiddle::CStructBuilder.create directly.

from fiddle.

kou avatar kou commented on August 22, 2024

Ah, I got it. The creator wants to hide implementation details.

from fiddle.

chrisseaton avatar chrisseaton commented on August 22, 2024

The problem is that these terms are super vague. 'entity'? That could mean anything or nothing. Here, an 'entity' is really a pointer to an instance of a type.

And CStruct is really a sort of factory... an object that supplies something used in a constructor. It could be a symbol like :struct instead.

from fiddle.

kou avatar kou commented on August 22, 2024

What do you want to do in this issue?
Do you want to add more documents?
Do you want to reconstruct lib/fiddle/struct.rb?

from fiddle.

chrisseaton avatar chrisseaton commented on August 22, 2024

I think I've clarified this in #41.

from fiddle.

kou avatar kou commented on August 22, 2024

OK.
I close this.

from fiddle.

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.