hoaproject / Core

The Hoa\Core library.

Home Page:https://hoa-project.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add some parameter keywords.

Metalaka opened this issue · comments

Hi,
I think it can be cool to add some parameter keywords like :ds: and :rs: (see #29 for RS).

The goal is to avoid any long concatenation when setting parameters.

Hello :-),

What about transforming / by DS? Would it be relevant for each value? I have a doubt. Also, I would like to invite @osaris and @CircleCode to give their opinion :-).

The keyword will be :/: or / ?

We need to not change the hoa protocol uri like Hoa\Database\Dal can use.
'connection.list.default.dsn' => 'sqlite:hoa://Data/Variable/Database/Foo.sqlite'

Also I think :/: it's not rely readable.

/ is bad idea since we can't replace / by DS everytime. :/: is interesting. What do you prefer: :/: or :ds:? Keep in mind we should also propose :rs:. /vote @hoaproject/hoackers!

For example, the Hoa\Core parameters.

With :ds: and :rs:.

array(
    'root.hoa'         => '(:root:)',
    'root.application' => '(:cwd:h:)',
    'root.data'        => '(:%root.application:h:ds:)Data',

    'protocol.Application'            => '(:%root.application:ds:)',
    'protocol.Application/Public'     => 'Public(:ds:)',
    'protocol.Data'                   => '(:%root.data:ds:)',
    'protocol.Data/Etc'               => 'Etc(:ds:)',
    'protocol.Data/Etc/Configuration' => 'Configuration(:ds:)',
    'protocol.Data/Etc/Locale'        => 'Locale(:ds:)',
    'protocol.Data/Library'           => 'Library(:ds:)Hoathis(:ds:rs:)' .
                                         'Library(:ds:)Hoa(:ds:)',
    'protocol.Data/Lost+found'        => 'Lost+found(:ds:)',
    'protocol.Data/Temporary'         => 'Temporary(:ds:)',
    'protocol.Data/Variable'          => 'Variable(:ds:)',
    'protocol.Data/Variable/Cache'    => 'Cache(:ds:)',
    'protocol.Data/Variable/Database' => 'Database(:ds:)',
    'protocol.Data/Variable/Log'      => 'Log(:ds:)',
    'protocol.Data/Variable/Private'  => 'Private(:ds:)',
    'protocol.Data/Variable/Run'      => 'Run(:ds:)',
    'protocol.Data/Variable/Test'     => 'Test(:ds:)',
    'protocol.Library'                => '(:%protocol.Data:)Library(:ds:)Hoathis(:ds:rs:)' .
                                         '(:%protocol.Data:)Library(:ds:)Hoa(:ds:rs:)' .
                                         '(:%root.hoa:ds:)Hoathis(:ds:rs:)' .
                                         '(:%root.hoa:ds:)Hoa(:ds:)',

    'namespace.prefix.*'           => '(:%protocol.Data:)Library(:ds:rs:%root.hoa:ds:)',
    'namespace.prefix.Application' => '(:%root.application:h:ds:)',
)

With :/: and :rs:.

array(
    'root.hoa'         => '(:root:)',
    'root.application' => '(:cwd:h:)',
    'root.data'        => '(:%root.application:h:/:)Data',

    'protocol.Application'            => '(:%root.application:/:)',
    'protocol.Application/Public'     => 'Public(:/:)',
    'protocol.Data'                   => '(:%root.data:/:)',
    'protocol.Data/Etc'               => 'Etc(:/:)',
    'protocol.Data/Etc/Configuration' => 'Configuration(:/:)',
    'protocol.Data/Etc/Locale'        => 'Locale(:/:)',
    'protocol.Data/Library'           => 'Library(:/:)Hoathis(:/:rs:)' .
                                         'Library(:/:)Hoa(:/:)',
    'protocol.Data/Lost+found'        => 'Lost+found(:/:)',
    'protocol.Data/Temporary'         => 'Temporary(:/:)',
    'protocol.Data/Variable'          => 'Variable(:/:)',
    'protocol.Data/Variable/Cache'    => 'Cache(:/:)',
    'protocol.Data/Variable/Database' => 'Database(:/:)',
    'protocol.Data/Variable/Log'      => 'Log(:/:)',
    'protocol.Data/Variable/Private'  => 'Private(:/:)',
    'protocol.Data/Variable/Run'      => 'Run(:/:)',
    'protocol.Data/Variable/Test'     => 'Test(:/:)',
    'protocol.Library'                => '(:%protocol.Data:)Library(:/:)Hoathis(:/:rs:)' .
                                         '(:%protocol.Data:)Library(:/:)Hoa(:/:rs:)' .
                                         '(:%root.hoa:/:)Hoathis(:/:rs:)' .
                                         '(:%root.hoa:/:)Hoa(:/:)',

    'namespace.prefix.*'           => '(:%protocol.Data:)Library(:/:rs:%root.hoa:/:)',
    'namespace.prefix.Application' => '(:%root.application:h:/:)',
)
commented

RS and DS are constants.
This issue suggests parsing all strings by str_replace().
Which cases need a dynamical replacement?
How rude!

I face the same trouble as @1e1: why would we replace native constant system by manual parsing?

(:ds:) and (:rs:) must be written outside a group (:…:) but it's ok.
@1e1, @CircleCode: what? I don't get your arguments. The idea is to avoid: 'Public' . DS, and use 'Public(:/:)' instead. Maybe this is a bad idea, I don't know, this is why we discuss.

@Hywan I don't see the benefit of 'Public(:/:)' over 'Public' . DS… More, I see that 'Public' . DS is expanded by php itself while 'Public(:/:)' need to be expanded by Hoa.

I agree. I propose to wait the answer of @Metalaka to decide :-).

I would like to avoid any long concatenation of DS and RS, it's the only benefit.
But it can slow Hoa...