Feeds:
Posts
Comments

Redmine

Something new we’ve been using at the workplace is the project management/issue tracking system Redmine.

This isn’t so much a review as it is a go check it out, it’s cool.

Final Update:

I’ve made a feature request to 4D
http://forums.4d.fr/Post/EN/4516107/1/4516108#4516108

Original Post:

While programming in 4D I discovered that 1/0 does not throw an error, and that it could be stored into a record as INF when the data type is REAL. Please someone tell me they find this as unreasonable as I do.

UPDATE: Depending on the declared type of the variable 4D stores two different results

[Table]Field_Real:=1/0 ` results is INF
` totally unrelated but just as bizarre
[Table]Field_Integer:=1/0 ` results is 2147483647

Why is this bad? Well for one php, ruby, python, perl, java, c++, javascript, calculators, all throw errors when dividing by zero so why doesn’t 4D?

Also, how do you do a SQL call on INF? How you query on INF? Why can you store an infinite number in a REAL datatype? Why does 4D return a different result for the same operation depending on data type?

  ` declare some variables
C_REAL($inf)
C_TEXT($tmp)
  ` $inf = 0
$inf:=1
  ` $inf=1
$inf:=1/0
  ` $inf=INF ($inf#"INF" comparison error)
$inf:=$inf+10
  ` $inf still equal INF
$tmp:=String($inf)
  ` $tmp="INF"
If ($tmp="INF")
    ALERT("inf")
End if 

CREATE RECORD([People])
[People]Name:="Joe Bob" ` data type alpha
[People]Hourly_Rate:=$inf ` data type REAL
  ` [People]Hourly_Rate=INF (even the field object shows "INF" on a form)
SAVE RECORD([People])

I called 4D, they didn’t know if I could file a bug because it wasn’t clear if it’s a feature or an undocumented part of the system.

UPDATE:

4D says INF is really the representation of a “really large” number. Thus it is a feature, and is up to the developer to make sure not to divide by zero.

I know there is the ON ERR CALL but personally I think that fragments the code into separate methods. Having a concept of THROWS would be icing on the cake.

I’m not advocating the removal of ON ERR CALL but I would love to just do something like below for simple try/catch concepts.

I suppose this type of concept is available with 4Dv12 and PHP, but not natively.

` this is my method that is called when ANY error is thrown
ON ERR CALL("catch error")

` throws error which goes into "catch error" method call
$result:=Create document($1) ` none specified
Design a site like this with WordPress.com
Get started