Giter Site home page Giter Site logo

Bump new version about pegged HOT 7 CLOSED

iK4tsu avatar iK4tsu commented on July 18, 2024
Bump new version

from pegged.

Comments (7)

ljmf00-wekaio avatar ljmf00-wekaio commented on July 18, 2024 1

Yes, cast(void*) is pretty much breaking the type system, in terms of changing type qualifiers or lifetime attributes. This shouldn't be required if the compiler could construct a DAG of the lifetimes and do these checks properly, but you can read more about the issue in the referenced bugzilla tickets on the PR you just mentioned.

from pegged.

veelo avatar veelo commented on July 18, 2024 1

New release: v0.4.7.

from pegged.

ljmf00-wekaio avatar ljmf00-wekaio commented on July 18, 2024

I need to finish something I promised but end up getting at the bottom of my task list.

from pegged.

veelo avatar veelo commented on July 18, 2024

For context, this is it: #314 (comment).

To be fair, that change is likely necessary only when dmd#14236 gets merged, and that PR has currently stalled (@dkorpel). So we could decide to tag Pegged now if we remember to make the change before a new DMD release makes that necessary.

It seems a rather trivial change, though, so @iK4tsu if you want to have a go at it, maybe @ljmf00-wekaio can review it and we can release without pending TODO's.

from pegged.

ljmf00-wekaio avatar ljmf00-wekaio commented on July 18, 2024

Yes, if you can @iK4tsu, I appreciate. It's basically implement something like:

/**
 * Assume non scope variable
 *
 * This function casts away scope attribute from the given parameter.
 *
 * Params:
 *     arg = The scope variable to cast scope away
 *
 * Returns: the variable `arg` as is, but without scope attribute.
 *
 * Note: This breaks the language type system.
 */
@nogc
auto ref assumeNonScope(T)(auto ref scope T arg)
{
    return *cast(T*)cast(void*)&arg;
}

And use in the dip1000 hacks I added.
Also, worth mentioning @dkorpel that the hack with size_t doesn't work with all types, hence I use void*.

from pegged.

veelo avatar veelo commented on July 18, 2024

* Note: This breaks the language type system.

Could you help me understand why it is necessary to break the language type system? Is it because the compiler gets it wrong (#314 (comment))?

from pegged.

iK4tsu avatar iK4tsu commented on July 18, 2024

Yes, if you can @iK4tsu, I appreciate. It's basically implement something like:

/**
 * Assume non scope variable
 *
 * This function casts away scope attribute from the given parameter.
 *
 * Params:
 *     arg = The scope variable to cast scope away
 *
 * Returns: the variable `arg` as is, but without scope attribute.
 *
 * Note: This breaks the language type system.
 */
@nogc
auto ref assumeNonScope(T)(auto ref scope T arg)
{
    return *cast(T*)cast(void*)&arg;
}

And use in the dip1000 hacks I added. Also, worth mentioning @dkorpel that the hack with size_t doesn't work with all types, hence I use void*.

casting to void* does not cast away scope

from pegged.

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.