Giter VIP home page Giter VIP logo

Comments (6)

kLabz avatar kLabz commented on May 26, 2024

Same issue there:

	static inline function allocUID() : UID {
		return (SEQ << (#if hxbit64 64 #else 32 #end - SEQ_BITS)) | (++UID);
	}

With hxbit.UID should be Int on ++UID. Reverting a57c74c fixes that.

from haxe.

Simn avatar Simn commented on May 26, 2024

I have no intuition for how accessor + operator overload should interact here. Should this behave the same way as the += case or what?

from haxe.

yuxiaomao avatar yuxiaomao commented on May 26, 2024

The case of @kLabz is exactly why I open this issue. I'm replacing it locally to continue my dev, with

UID += 1;
return (SEQ << (#if hxbit64 64 #else 32 #end - SEQ_BITS)) | (UID);

from haxe.

ncannasse avatar ncannasse commented on May 26, 2024

@Simn if we have a + operator, we should be able to use += and prefix/postfix ++ , by generating the following code:

x += 1; // x = X.add(x,1)
++x; // same
x++;  // { var tmp = x; x = X.add(x,1); tmp; }

from haxe.

Simn avatar Simn commented on May 26, 2024

Ok hang on, the specification is really not clear to me. We can have three different kinds of operator overload:

  1. @:op(A + B)
  2. @:op(A += B)
  3. @:op(++A)

If I'm understanding what you're saying correctly, the following should be true:

  1. An expression a + b only checks for @:op(A + B)
  2. An expression a += b checks for @:op(A += B), and if that's not applicable it checks for @:op(A + B)
  3. An expression ++a checks for @:op(++A), and if that's not applicable it checks for @:op(A += B), and if that's not applicable it checks for @:op(A + B)

Is that correct? Note that I'm not even talking about getters/setters because it seems like the problem here starts even earlier.

from haxe.

yuxiaomao avatar yuxiaomao commented on May 26, 2024

I thought that @:op(A++) is defined for haxe.Int64 which will performs an add1 (seems quite natural for me as that's an Int), I must have misunderstood something :'(
If I recall correctly, @ncannasse said that ++ on String should not be valid (but there is a + on String), so I do not think ++ should automatically performs a +1

from haxe.

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.