Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Search Forums

Showing results 1 to 9 of 9
Search took 0.00 seconds.
Search: Posts Made By: AnonymousHero
Forum: Idle chatter March 30, 2012, 12:44
Replies: 24
Views: 11,243
Posted By AnonymousHero
You don't avoid it -- you embrace it! :) I...

You don't avoid it -- you embrace it! :)

I realize it may look quite alien at first, but I find that in the long run being explicit about state updates (rather than "allowing" them anywhere) is a...
Forum: Idle chatter March 29, 2012, 07:40
Replies: 24
Views: 11,243
Posted By AnonymousHero
Here's a more in-depth response: Let's start...

Here's a more in-depth response:

Let's start by imagining the whole game state as mutable. That is, monster (instances) are mutable, player object is mutable, items are mutable. In addition the...
Forum: Idle chatter March 28, 2012, 07:16
Replies: 24
Views: 11,243
Posted By AnonymousHero
That doesn't look too bad to me. Obviously you'd...

That doesn't look too bad to me. Obviously you'd want to hide this away in a decorator or something for easy use, so you'd be able to write something like:


@struct
class X:
def...
Forum: Idle chatter March 28, 2012, 07:13
Replies: 24
Views: 11,243
Posted By AnonymousHero
Yes, a new instance. In the case of Python's...

Yes, a new instance. In the case of Python's named tuples, what you'd do is

>>> p = Point(x=11, y=22,z=44)
>>> p2 = p._replace(x=33, z=55)
Point(x=33, y=22,z=55)

The idea is that: 1) you just...
Forum: Idle chatter March 27, 2012, 22:08
Replies: 24
Views: 11,243
Posted By AnonymousHero
Sure -- I'll try to respond in-depth on this...

Sure -- I'll try to respond in-depth on this tomorrow.


I was thinking of the specific situation of code like

x.aFieldName = 123

where you really meant

x.aFieldname = 123
Forum: Idle chatter March 27, 2012, 21:19
Replies: 24
Views: 11,243
Posted By AnonymousHero
IME choosing immutability leads to more obvious...

IME choosing immutability leads to more obvious code, and far fewer bugs. As a bonus it often also makes testing a lot easier since f(a) will always return the same value given the same value of "a"....
Forum: Idle chatter March 27, 2012, 20:59
Replies: 24
Views: 11,243
Posted By AnonymousHero
Perhaps my example of "f(a,b,c)" didn't convey my...

Perhaps my example of "f(a,b,c)" didn't convey my intended meaning very well. The idea is that the selection of a concrete implementation of "f" can actually depend on the types of any, some or all...
Forum: Idle chatter March 27, 2012, 19:00
Replies: 24
Views: 11,243
Posted By AnonymousHero
Hey! You say that as if there's something wrong...

Hey! You say that as if there's something wrong with procedural programming... :)



... but of course here you're right. If you still have monstrosities such as m_list indexed by a "monster...
Forum: Idle chatter March 27, 2012, 18:47
Replies: 24
Views: 11,243
Posted By AnonymousHero
As far as I can tell you've just described......

As far as I can tell you've just described... variables, haven't you? I mean a "Thing" is a value and a "Set" is just a collection of values (e.g. could be a list, or a bona fide set, or whatever)...
Showing results 1 to 9 of 9

 
Forum Jump

All times are GMT +1. The time now is 18:27.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.