AnonMiraj / fig

FIG (Fortran Intuitive Graphics)
MIT License
27 stars 2 forks source link

Miscellaneous #22

Closed perazz closed 3 months ago

perazz commented 6 months ago

List of miscellaneous improvements that I'm seeing on the current repository

https://github.com/AnonMiraj/fig/blob/36c15fac34c156fb1dd40369e0b9a1cab0a695a6/src/fig_rgb.f90#L15-L23

https://github.com/AnonMiraj/fig/blob/36c15fac34c156fb1dd40369e0b9a1cab0a695a6/src/fig_rgb.f90#L25-L32

i.e. something like

interface RGB
   module procedure int_to_rgb
end interface

! So you can define your RGBs as 
my_color = RGB(pixel_int)

https://github.com/AnonMiraj/fig/blob/36c15fac34c156fb1dd40369e0b9a1cab0a695a6/src/fig_rgb.f90#L41

type(mytype)
...
contains
   procedure, non_overridable :: to_int => rgb_to_int
end type

cc @everythingfunctional @johandweber

everythingfunctional commented 6 months ago
  • Put class functions inside the derived type:

I'm actually starting to move away from this unless polymorphism is actually going to be used. It feels like a nicer syntax and less namespace pollution, but I'm less and less convinced it's worth it to couple to a language/design feature that you aren't actually taking advantage of.

The rest I pretty well agree with.