https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • k

    kind-policeman-40412

    07/30/2020, 7:59 AM
    just noob haxor issue ))
  • b

    bright-gpu-74537

    07/30/2020, 7:59 AM
    if:
  • b

    bright-gpu-74537

    07/30/2020, 8:00 AM
    var x:Dynamic = buildComponent(...)
    is used it think it stays as an Expr
  • b

    bright-gpu-74537

    07/30/2020, 8:00 AM
    however, if:
  • b

    bright-gpu-74537

    07/30/2020, 8:00 AM
    var x:Component = ...
    then all is fine
  • b

    brainy-machine-50829

    07/30/2020, 8:00 AM
    That's an expression macro. It must always return an Expr, but once its out of macro context, it's typed depending on what the Expr is.
  • k

    kind-policeman-40412

    07/30/2020, 8:00 AM
    so it's not casted to component which does have all the methods...
  • b

    brainy-machine-50829

    07/30/2020, 8:00 AM
    You can't work with Expr outside of macro context.
  • k

    kind-policeman-40412

    07/30/2020, 8:01 AM
    nice. I should learn macros. didn't invested time into this topic. sorry )
  • b

    bright-gpu-74537

    07/30/2020, 8:01 AM
    sure, but for some reason, if the result is assigned to a Dynamic then things dont work... im not sure if gets typed correctly
  • b

    bright-gpu-74537

    07/30/2020, 8:01 AM
    i havent tested this myself, so its all just guesses
  • b

    brainy-machine-50829

    07/30/2020, 8:02 AM
    If you assign it to a Dynamic, you work with it as if it was Dynamic. But it shouldn't cause any issues apart from ones that are caused by something being Dynamic. 🙂
  • b

    brainy-machine-50829

    07/30/2020, 8:02 AM
    So what are the things that don't work?
  • b

    bright-gpu-74537

    07/30/2020, 8:02 AM
    yeah, thats what i would have thought
  • b

    bright-gpu-74537

    07/30/2020, 8:03 AM
    i think all the component functions, dont worrk, is that correct @User - what if you try something basic like setting the text of the component? Ill have a this afternoon, got meetings in an hour
  • k

    kind-policeman-40412

    07/30/2020, 8:03 AM
    I cant use
    ui.findComponent
    from screenshot above if ui is Dynamic on neko target. it throws an exception
    Uncaught exception - Invalid call
  • b

    bright-gpu-74537

    07/30/2020, 8:04 AM
    but works on hxcpp?
  • k

    kind-policeman-40412

    07/30/2020, 8:04 AM
    yeah it works on hxcpp
    lime build linux && lime run linux
  • b

    brainy-machine-50829

    07/30/2020, 8:04 AM
    Interesting. Most likely a neko bug then, which no one is going to fix these days.
  • b

    bright-gpu-74537

    07/30/2020, 8:04 AM
    fair enough... weird... well, i guess for now just type it as component... dont quite understand it tbh
  • b

    brainy-machine-50829

    07/30/2020, 8:05 AM
    A neat trick in macros is to explicitly type the result, if it's not already there.
  • k

    kind-policeman-40412

    07/30/2020, 8:05 AM
    @User I had some troubles with HL I don't remember already )
  • b

    brainy-machine-50829

    07/30/2020, 8:05 AM
    Then just doing
    var foo = macroCall(); $type(foo);
    would show the correct type due to inference.
  • k

    kind-policeman-40412

    07/30/2020, 8:05 AM
    so I use Neko which works almost always
  • b

    brainy-machine-50829

    07/30/2020, 8:06 AM
    Neko is old, simple, and not really maintained anymore (I think).
  • k

    kind-policeman-40412

    07/30/2020, 8:06 AM
    i mean for development and debugging only. but I understand. should drop it
  • b

    bright-gpu-74537

    07/30/2020, 8:06 AM
    yeah, i think if you dont type it, its fine, its when you explicity type the result as Dynamic i think
  • b

    bright-gpu-74537

    07/30/2020, 8:06 AM
    > A neat trick in macros is to explicitly type the result, if it's not already there.
  • b

    bright-gpu-74537

    07/30/2020, 8:06 AM
    got an example?
  • b

    brainy-machine-50829

    07/30/2020, 8:07 AM
    Something like instead of
    return expr
    , you do
    return macro ($expr:$type)
    .
1...329330331...1687Latest