What programming language people are migrating to?
-
@magus said in What programming language people are migrating to?:
@accalia I think the biggest problem people have is that the game is a sequel to a movie that you need to have seen, and a bunch of stuff was missing at launch. People seemed confident that it would be better by now, but I haven't paid any attention since.
Now I want to go play through Chrono Cross again...
That's what I'm currently playing. It's been many years.
-
@masonwheeler said in What programming language people are migrating to?:
Among other things, Chrono Trigger was known for its groundbreaking battle system, in which the position of each combatant on the battlefield is of paramount importance...
I really like Chrono Trigger, but this is actually something that kind of annoyed me. A decent number of abilities are based on characters' position on the field, but the player has practically no control over it. Poor placement by the computer, which is effectively random, can make it impossible to use certain abilities, and there's nothing you can do about it.
-
@dragnslcr Hmm... TBH I never had much of a problem with that.
If you're not fighting a boss, you don't really need techs 99% of the time. (And by the time you reach the ones you really do need them for, you have stuff that can hit anyone anywhere.)
If you are fighting a boss, there's no random placement; you always end up somewhere where you can use your techs to good effect.
-
@masonwheeler said in What programming language people are migrating to?:
@dragnslcr Hmm... TBH I never had much of a problem with that.
If you're not fighting a boss, you don't really need techs 99% of the time. (And by the time you reach the ones you really do need them for, you have stuff that can hit anyone anywhere.)
If you are fighting a boss, there's no random placement; you always end up somewhere where you can use your techs to good effect.
Yeah, it wasn't a problem 99% of the time. It's a lot like whitespace in Python - it pretty much never makes any actual difference, but the general idea goes against the way you normally think.
-
@magus said in What programming language people are migrating to?:
Never Chrono or Marle. Somehow, they aren't ever mentioned.
So you missed that part. Yeah.
-
@dse said in What programming language people are migrating to?:
The data model is in Python, and uses metaclasses. Behind the code, it all is translated to SQL and joins, ...
The implementation is metaclasses, but it blends in so smoothly that there is no need to mention the fact.FWIW, I think Python makes too big a song and dance about metaclasses. They're just a way to take greater control over classes themselves, and a logical extension of making classes be objects themselves. (OTOH, they also make it far too hard to use these advanced facilities in general. I've written object systems from scratch a few times; I know what can be done and I hate how Python yet again goes for the miserably myopic option. And there's kids on my lawn…)
The implications of metaclasses run pretty deep. Especially once you start putting metaclasses on your metaclasses (yo dawg…)
-
@dkf When I wrote up that proposal, I wasn't actually thinking of Python; I was thinking of Delphi.
Anders Hejlsberg, the architect of C# and the .NET framework, was the architect of Delphi first, which is why so much of the early .NET stuff feels a lot like "Delphi rewritten to look like Java"--because that's not too far from what it was! So it's a bit surprising to look at .NET dev and not find metaclasses anywhere, when they're used all over the place in Delphi. (And not as "a logical extension of making classes be objects themselves," because they're not.)
-
@masonwheeler No, the only time they're even in the game, they're simply temporal ghosts of people who were never born. Because even Lucca is among them, and we know she was older than that ghost. They say the kingdom got taken over, but by a town that barely had any people in it 10 years before in the CT timeline. What species exist and how civilization developed seems to be completely different in this timeline, so we can't know if they were even born.
Whatever you think you saw in the game about them, you didn't: They are never mentioned, apart from the ghosts.
-
@xaade said in What programming language people are migrating to?:
Can't we just have something more reasonable that compiles into javascript?
Then we'd get the benefit of the includes being on the new language side, this way only what's used goes on the site?Isn't that what typescript is supposed to be?
Although my greatest hope is that WebAssembly takes off without a hitch, the collective comes up with a good library every browser includes, and it becomes just another target for compilation of arbitrary languages.
-
@dreikin said in What programming language people are migrating to?:
just another target for compilation of arbitrary languages.
We're already halfway there: http://kripken.github.io/emscripten-site/
-
@dkf said in What programming language people are migrating to?:
I've written object systems from scratch a few times; I know what can be done and I hate how Python yet again goes for the miserably myopic option.
My impression of Python thus far is a language with some nice ideas and a good community hindered by a mediocre implementation.
-
@dkf can you explain why would we want metaclasses? The examples I found were not that different from a normal base class. I don't see the point.
-
@wharrgarbl Basically, metaclasses let you do things like intercepting
new
. That means in turn that you can do a lot to hide factory patterns away from code that doesn't really need to know about them: you asked an instance ofFooBar
and you got one; the fact that it was actually aFooBar123Subclass
is the implementations business, not yours. However, there's a lot of things beyond that. It's entirely possible to have metaclasses that construct classes for you by examining a database's schema, generating all the code based off of what is actually there. (You can do that with an ahead-of-time compilation phase too, but then there's always the worry that you'll get out of synch with the DB.)Myself, I prefer to work with a language that likes binding objects to names and one of the main uses there for metaclasses is controlling that binding process. That's not so meaningful in Python though, where name binding is a more separate mechanism.
-
@wharrgarbl Metaclasses can have a few different uses.
First, as @dkf said, they can make
new
more interesting. From a non-Python, static perspective, if you declare a variable of typeMetaclass of Foo
(with whatever syntax you'd prefer) you're saying that it will accept theFoo
metaclass or the metaclass of any class that inherits fromFoo
. You can then call a constructor on the metaclass variable--any constructor thatFoo
has, not just a parameterless constructor--which will construct an object of the appropriate type. It lets you turn thenew
class type itself into a variable which can be passed around like any other variable.This property can be used to make the Factory Pattern trivial. This is how the visual form designer works in Delphi: the base Component class has a virtual constructor, and the form data is serialized to a simple markup format that contains class names, property lists, and object heirarchies. At program startup, all components get registered with the form deserializer in what's essentially a
Dictionary<string, component metaclass>
that maps the name to the appropriate metaclass. Then the form deserializer reads the class name, looks up the metaclass, and invokes the virtual constructor on it.Another use is for more limited object generation than a full-blown Factory Pattern. For example, have you ever seen a requirement like this?
Every time you create a
Foo
, itsBar
property should be assigned a newBaz
, except when the program is in this certain state, in which case we want to give it a newSpecializedBazDescendant
object insteadThere are a handful of ways you could do this. You could try and remember to assign the right property after calling the constructor in every instance where you create a
Foo
. (It should be obvious to WTDWTF forumers that this is a bad idea for several reasons.) Or you could give theFoo
class a way to do it on its own, such as by providing it a static property that's a lambda that returns aBaz
, which can be replaced as needed.But why use a lambda, with all the compiler baggage that entails, when you could just stick a metaclass in there?
There are more advanced uses, but the most common and probably most useful thing about them is making it easy to create objects of arbitrary classes, whose type is determined at runtime, without any need for Reflection or the throwing away of static type checking that it entails.
-
@dkf said in What programming language people are migrating to?:
You can do that with an ahead-of-time compilation phase too, but then there's always the worry that you'll get out of synch with the DB.
It's basic fail-fast philosophy here: If your code isn't set up to deal with the changed schema, it's better to error out as early as possible, rather than silently change your object model out from under the unsuspecting code, thereby making the problems that that ends up causing show up later on in the program's execution, making the real problem harder to track down.
-
@masonwheeler said in What programming language people are migrating to?:
Every time you create a Foo, its Bar property should be assigned a new Baz, except when the program is in this certain state, in which case we want to give it a new SpecializedBazDescendant object instead
Foo:Foo() { if (snowflake) baz = new SnowflakeBaz(); else baz = nee Baz(); }
?
-
@wharrgarbl That's great, right up until there are multiple snowflake conditions, or they're based on stuff that the
Foo
class really shouldn't need to have knowledge of in its constructor.
-
@wharrgarbl said in What programming language people are migrating to?:
@masonwheeler said in What programming language people are migrating to?:
Every time you create a Foo, its Bar property should be assigned a new Baz, except when the program is in this certain state, in which case we want to give it a new SpecializedBazDescendant object instead
Foo:Foo() { if (snowflake) baz = new SnowflakeBaz(); else baz = nee Baz(); }
?
nee
seems like a cool new operator, but rather easy to confuse withnew
. They really should have named it like so:Foo:Foo() { if (snowflake) baz = new SnowflakeBaz(); else baz = theArtistFormerlyKnownAs Baz(); }
Much easier to tell apart, don't you agree?
-
@masonwheeler said in What programming language people are migrating to?:
they're based on stuff that the Foo class really shouldn't need to have knowledge of in its constructor.
If it changes baz, Foo should know about that
-
@wharrgarbl said in What programming language people are migrating to?:
@masonwheeler said in What programming language people are migrating to?:
they're based on stuff that the Foo class really shouldn't need to have knowledge of in its constructor.
If it changes baz, Foo should know about that
If
Foo
only cares that it's anIEnumerable<T>
then it shouldn't matter whether it's aList<T>
or aHashSet<T>
is the point, I think.
-
@dreikin Essentially, yeah.
-
@masonwheeler said in What programming language people are migrating to?:
It lets you turn the new class type itself into a variable which can be passed around like any other variable.
Then it'll be fake news, and we don't want more of this, right?
-
@wharrgarbl ???