Giter Club home page Giter Club logo

Comments (15)

fabriciofx avatar fabriciofx commented on September 18, 2024 2

@vssekorin The main constructor is code-free. But the secondary constructor can instanciate objects. Pay attention that instantiation doesn't execute any action (method executing or something like that). This will be performed later.

from cactoos.

fabriciofx avatar fabriciofx commented on September 18, 2024 1

E.g. java.lang.CharSequence interface might be used instead of org.cactoos.Text and then string consuming might be looks like
new UpperText("some java literal")
as java.lang.String already implements java.lang.CharSequence interface.

@Englishman What do you think to use a secondary constructor to it? Like:

public final class UpperText implements Text {
  public UpperText(final String string) {
    this(new StringAsText(string));
  }
  public UpperText(final Text origin) {
    this.origin = origin;
  }
}

from cactoos.

0crat avatar 0crat commented on September 18, 2024

@Englishman I'm not managing this repo, remove the webhook or contact me in Slack //cc @yegor256

from cactoos.

vssekorin avatar vssekorin commented on September 18, 2024

if (new IsBlank(new StringAsText("java string")).asValue()) {
...
}
For me the both producing and consuming look a bit cumbersome and verbose. Is there any way to make JDK interaction smoothly?

It looks like part of the procedure.
My suggestion:

new CondProc<>(
    conditional,
    firstProcedure,
    secondProcedure
).apply(...);

and

Type object = new Ternary<>(
    conditional,
    firstFunction, //Func<Something1, Type>
    secondFuntion //Func<Something2, Type>
).apply(...);

But I'm not sure about this completely. We had to wait for @yegor256 reply.

from cactoos.

akryvtsun avatar akryvtsun commented on September 18, 2024

@vssekorin yes, I thought about the such approach but you suggestion is a substitute of Java lang standard if statement. So Cactoos will be kind of a framework but not a library then.

BTW here

new CondProc<>(
    conditional,
    firstProcedure,
    secondProcedure
).apply(...);

what are apply method params?

from cactoos.

vssekorin avatar vssekorin commented on September 18, 2024

It's OO primitives library, I have proposed OO analog if.

what are apply method params?

Type object = new Ternary<>(
    conditional, //Func.Pred<Some1>
    first, //Func<Some2, Type>
    second //Func<Some3, Type>
).apply(Some1 arg1, Some2 arg2, Some3 arg3);

(My example is wrong. I used it to explain the idea.)

from cactoos.

akryvtsun avatar akryvtsun commented on September 18, 2024

@yegor256 WDYT? Pls, share you strategical opinion here.

from cactoos.

yegor256 avatar yegor256 commented on September 18, 2024

@Englishman I think we should try to stay as far away from JDK "things" as we can. Otherwise, we will just create another Guava. That's why that Scalar and others. Of course, we can add implements Number to, say, LengthOfIterable, for extra convenience. Feel free to submit a PR.

from cactoos.

vssekorin avatar vssekorin commented on September 18, 2024

@fabriciofx What about Constructors Must Be Code-Free? I'm not sure that this is the right solution.

from cactoos.

akryvtsun avatar akryvtsun commented on September 18, 2024

@fabriciofx like your idea! At least, we'll have a cheap one-way of JDK interaction.

from cactoos.

akryvtsun avatar akryvtsun commented on September 18, 2024

@vssekorin @fabriciofx but look on this discussion.
#20 (comment)
It's not about new in ctors. It's about some code. WDYT?

Added separate issue #62 for this

from cactoos.

llorllale avatar llorllale commented on September 18, 2024

@Englishman I believe this issue no longer applies. We now have TextOf(CharSequence); we can also do new UpperText(Text) or new UpperText(() -> "your string"). Can we close this?

from cactoos.

llorllale avatar llorllale commented on September 18, 2024

@Englishman can we close this?

from cactoos.

llorllale avatar llorllale commented on September 18, 2024

@Englishman closing

from cactoos.

0crat avatar 0crat commented on September 18, 2024

The job is not in WBS, won't close the order

from cactoos.

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.