gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Painter Fuzzy Node in github


From: Johan Ceuppens
Subject: Re: Painter Fuzzy Node in github
Date: Wed, 17 Dec 2014 18:01:24 +0100

Hello,

2014-12-17 17:34 GMT+01:00 David Chisnall <address@hidden>:
On 17 Dec 2014, at 17:23, Johan Ceuppens <address@hidden> wrote:

> Hello,
>
> I am writing a small prolog system with a decision tree which understands "not x" and "x" for now. This can be used in the CALayer as said before by Ivan here.
>
> The interface is as follows :
>         //make predicates which is an NSString
>         OpalFuzzyPredicate *pred = [[OpalFuzzyPredicate alloc] init];
>         //initialize it with a string which in this case is multi-worded
>         [pred initWithString:@"update full window";

Sending an init-family method to an object that has already been initialised is usually undefined behaviour.


I didn't know. I thought init was part of NSObject.
 
>        //so it becomes a compound, which gets parsed and
>         //adds comp to compound DB and compiles it into the tree
>         InferenceCompound *comp = [factory makeCompound:pred];

What is factory?  In Objective-C classes are usually factories, there's little need for the factory pattern in a language where class methods can be overridden.

The factory pattern makes for a static if you like, it's interface is like :
<code>
@interface OpalFuzzyDTreeFactory
{
        OpalFuzzyInference *_inference;
}
- (id) makeDTree;
- (id) makeADT:(OpalFuzzyPredicate*)p with:(Class)adt;
- (id) makeAtom:(OpalFuzzyPredicate*)p;
- (id) makeVar:(OpalFuzzyPredicate*)p;
- (id) makeNumber:(OpalFuzzyPredicate*)p;
- (id) makeCompound:(OpalFuzzyPredicate*)p;
- (id) compileToTree:(InferenceADT*)adt;
//_inference wrapper
- (id)createInferenceManipulator;
@end
 </code>

>
>         pred = [[OpalFuzzyPredicate alloc] init];
>         //initialize it with a string which in this case is multi-worded
>         [pred initWithString:@"not update full window";

Once again.  And why would you want to do this rather than reuse NSPredicate, which can already represent and operate on predicates?


If it's in Foundation OK then.
 
>
>         //so it becomes a compound, which gets parsed and
>         //adds comp to compound DB and compiles it into the tree
>         InferenceCompound *comp = [factory makeCompound:pred];
>
> I will try to get this in if I can do it.

Given your unwillingness to fully explain what you're doing and the appalling quality of your code (some of the diffs you've posted obviously wouldn't even compile due to mismatched braces, the rest is broken due to poor understanding of Objective-C conventions), I'd be very hesitant about your having commit access to a GNUstep repository until you've demonstrated that:

- You can communicate with other developers
- You can write useable code


Don't worry, I'll do that off-list :-)
 
David

-- Send from my Jacquard Loom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]