News for hackers. Stuff that matters.
Re:Introducing Syngr, my attempt at an Standard Library for PHP by gh0zt on Monday September 23, 2013 @07:53AM (#6430206)
I like the idea but i don't like the actual implementation. For example: Number::tan takes an array of flags as an argument but only one flag is ever used to determine which kind of tangent method is eventually executed. For me as a user this does not only complicate the usage but it is also potentially (microoptimizationwise) slower because of the necessary condition check.

So instead of

  $number = new Number(4.2);
  $number->tan(array(Number::TRIG_ARC))
why not just implementing it as a separate method?

  $number->atan();
Re:Introducing Syngr, my attempt at an Standard Library for PHP by niteshade on Monday September 23, 2013 @08:13AM (#6430284)
Well, PHP has four 'tan' functions, and in all fairness, I might just remove those functions altogether and leave the basic ones. I do agree that its longer to type now, but at the expense of remembering WTF atan() does.
Re:Introducing Syngr, my attempt at an Standard Library for PHP by gh0zt on Monday September 23, 2013 @08:25AM (#6430326)
Well, if you need the atan function you probably know what it should do and apart from that why does the Number:tan method take an array of arguments when only one is ever used? So at least it should be usable like tan(Number::Number::TRIG_ARC).