Giter VIP home page Giter VIP logo

Comments (5)

edgurgel avatar edgurgel commented on June 18, 2024 1

🤔
I'm wondering if something like this would work:

def eval(tag, context, options) do
   current_stack_level = context.stack_level

   context = %{context | stack_level: current_stack_level + 1}

    {result, new_context} = case do_eval(tag, context, options) do
      {text, context} -> 
        {text, context}

      text when is_binary(text) -> 
         {[text: text], context}

      text -> 
        {text, context}
    end

    new_context = %{new_context | stack_level: current_stack_level}

    {result, new_context}
end

And we just trust that tags are passing Context around?

If people add custom tags that don't pass the Context around then there is not much we can do to protect them?

And we change the render tag to pass the stack_level maybe through options? Solid.render(..., stack_level: context.stack_level)

What do you think?

The process solution could work if we maybe used the Process dictionary or something else like an ets table? But it feels hacky as you said 🤔

from solid.

bluzky avatar bluzky commented on June 18, 2024

@edgurgel do you have any idea on this?

When using render tag, it's hard to track nested tag. And we cannot use Context to carry nested tag level because some tag render does not pass context to inner scope.

Another thought is put nested level value in current process, but I think it's kind of hack

from solid.

Jcambass avatar Jcambass commented on June 18, 2024

If people add custom tags that don't pass the Context around then there is not much we can do to protect them?

Can't the Solig.Tag behaviour be used to at least clarify this expectation?

from solid.

edgurgel avatar edgurgel commented on June 18, 2024

@Jcambass yeah definitely worth documenting that!

from solid.

bluzky avatar bluzky commented on June 18, 2024

@edgurgel I think passing stack_level along with context is good idea.
Regarding custom tag, user should protect themselves 😈 . We provide document as @Jcambass said and that's enough, I think.

from solid.

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.