Re: Default cast LFUN
by Johan Sundstr�m (Achtung Liebe!) @ Pike (-) developers forum
22 Jan '07
22 Jan '07
(Dang. Wordy post, and almost completely unrelated to my proposal.)
> I guess I'd be in favor of it, but yet I'm not terribly excited about
> it. I wonder why...
Casting is unfortunately an often useless and ill designed feature in
Pike; that might account for some of the dispassion. You can only cast
to primitive types, and value casts don't necessarily work, even if
you know a value to be a string and want to cast it to an int, when
declared a string|int. It's a system difficult to …
[View More]grow incrementally
better too, unfortunately.
Even though in some ways it's a syntactically very powerful operation
on recursively casting a large data structure into another, using
compound type casts like (array(string)). It just doesn't reach do all
that much more, when you don't primarily work with primitive types.
I'm not really bashing the lack of design in Pike; its evolved nature
is what makes it good, too. But casts, at least to me, feel a bit like
a dead end.
The thought crept up on me after reading The Pinocchio Problem,
http://steve-yegge.blogspot.com/2007/01/pinocchio-problem.html --
while not technically dead code, pike and casting feels like it has
hit an evolutionary dead end. Small convenience changes like the one
suggested might be within reach, but order of magnitude improvements
are out of reach. With a bit of luck I just might know too little of
pike's internals to be right about this.
[View Less]
4
5
Default cast LFUN
by Johan Sundstr�m (Achtung Liebe!) @ Pike (-) developers forum
22 Jan '07
22 Jan '07
Would implementing a default cast("string") implementation for objects
that lack one be a good idea, if they respond to _sprintf("%s")? It is
somewhat magical. The same could theoretically apply to int/%d, but I
have a feeling it might be more questionable. Even more, float/%f. Any
thoughts?
Lessons learned from automatic _sprintf decoration have been largely
positive, in my experience. (That might not imply anything about this
proposal, though. It would, for instance, rarely throw errors …
[View More]about a
missing cast implementation, in concert with the _sprintf decorator.)
[View Less]
>OK, that all makes sense to me, but if I've missed an add_ref() in my
>code, shouldn't that cause the object to be freed or destructed
>prematurely? I added an add_ref(o) to my code to prevent this
>problem, but the result was that the objects weren't getting freed.
>I've stepped through a simple program that exhibits the problem, and
>that object comes to schedule_really_free_object() numerous times,
>each time with a refcount of 0 or -1. I've noticed that …
[View More]once it
>finally enters its endless loop, o->next == o... shouldn't that cause
>the loop to stop?
Please check if o->prog is still set the second time. If it is, and
the object is on the top of the objects_to_destruct queue, the queue
will become circular, and when the destruct pass comes it will loop
forever.
>Bill
[View Less]
I've been having a problem with pike going into what seems like an
infinite loop while exiting. The problem seems to occur with objects
from my Objective-C module, and it's something I noticed before, but
"solved" by adding a ref so that the objects were never freed. I
fixed that problem last night, and now the problem is back.
The backtrace looks like this:
#0 schedule_really_free_object (o=0x1812038) at /Users/hww3/Pike/7.7/
src/object.c:1068
#1 0x00016610 in low_return () at /…
[View More]Users/hww3/Pike/7.7/src/
interpret.c:2018
#2 0x0001697c in jump_opcode_F_RETURN_0 () at /Users/hww3/Pike/7.7/
src/interpret_functions.h:1601
#3 0x007d5260 in ?? ()
#4 0x0001a76c in catching_eval_instruction (pc=0x1039114) at /Users/
hww3/Pike/7.7/src/interpret.c:2212
#5 0x0001a864 in jump_opcode_F_CATCH () at /Users/hww3/Pike/7.7/src/
interpret_functions.h:1273
#6 0x01039108 in ?? ()
#7 0x000181ac in mega_apply (type=25239608, args=2, arg1=0x13,
arg2=0xffffffff) at /Users/hww3/Pike/7.7/src/interpret.c:2180
#8 0x00003644 in main (argc=2, argv=0xbffff974) at /Users/hww3/Pike/
7.7/src/main.c:569
and if I step through the code, I eventually get back to the same
point with the same object, and Pike never exits. Anyone with some
internals experience care to venture a guess as to what the problem
might be?
Bill
[View Less]
hi,
i just noticed that for some reason the chapter on pike internals which
can be found in an old version of the pike manual is not there anymore
in the current version:
http://fredrik.hubbe.net/pike/tutorial/tutorial_split_17.html
i think there are more useful sections in that old manual that are not
in the current one. i noticed this one because of people repeatedly
looking for documentation on the master, and that seems to be the only
place where that documentation seems to still exist.
…
[View More]anyone know why this has been dropped?
intentional (because it's maybe outdated)?
or by accident (lost during restructuring of sections)?
or is it simply waiting to be converted to the new doc format?
greetings, martin.
[View Less]