Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 23 12:43
    JesusValera synchronize #485
  • May 23 12:43

    JesusValera on refactor-repl-command

    Use gacela:dev-master branch (compare)

  • May 23 11:28
    JesusValera commented #485
  • May 23 10:32
    JesusValera commented #485
  • May 21 20:35
    Chemaclass assigned #485
  • May 21 20:19
    Chemaclass edited #485
  • May 21 20:17
    Chemaclass edited #485
  • May 21 20:17
    Chemaclass edited #485
  • May 21 17:46
    Chemaclass synchronize #485
  • May 21 17:46

    Chemaclass on refactor-repl-command

    Preparing ReplCommandTest. Thi… (compare)

  • May 21 16:32
    JesusValera review_requested #485
  • May 21 16:32
    JesusValera labeled #485
  • May 21 16:32
    JesusValera assigned #485
  • May 21 16:32
    JesusValera review_requested #485
  • May 21 16:32
    JesusValera opened #485
  • May 21 16:31

    JesusValera on refactor-repl-command

    Move logic from ReplCommand to … (compare)

  • May 21 08:08
    Chemaclass review_requested #484
  • May 21 08:08
    Chemaclass review_requested #484
  • May 21 08:08
    Chemaclass assigned #484
  • May 21 08:08
    Chemaclass labeled #484
Jens Haase
@jenshaase
We just released version 0.6.0. See our new blog for more information: https://phel-lang.org/blog/release-0-6/
3 replies
Jose Maria Valera Reales
@Chemaclass

The quickest way to try out Phel is to run our REPL Docker container.

docker run -it --rm phellang/repl

Kudos to @jenshaase -> https://phel-lang.org/#try-phel

Adam Stokes
@adamstokes:matrix.org
[m]
Specifically the performance mentioned when loading your blog
Adam Stokes
@adamstokes:matrix.org
[m]
To me it looks like you've resolved it with the compile ability
Jens Haase
@jenshaase
Hi @adamstokes:matrix.org yes this has been solved. @mabasic wrote the following:
I've managed to get the compile command to work and my TTFB went from cca. 1.06s down to 140ms!
1 reply
Adam Stokes
@adamstokes:matrix.org
[m]
Awesome!
I came across this https://openswoole.com/ and thought it would be an interesting project to use that with phel
Jens Haase
@jenshaase
Sure. Give it a try. I haven't used openswoole myself yet but if you need some help just let me know.
Adam Stokes
@adamstokes:matrix.org
[m]
I'm using this repo for reference https://github.com/mabasic/mariobasic-n7 but I can't figure out how to handle the compiling
I see out-dir set in phel-config.php and composer.json references running a local php webserver, and public/index.php contains code that references the compiled phel code
btw, this is a lot of fun
probably helped if I read the man page phel compile
Adam Stokes
@adamstokes:matrix.org
[m]
ah maybe Mario does that outside of the repo which is why i couldnt find it
5 replies
Jens Haase
@jenshaase
Yes he probably has some custom logic to build a deployable version.
I created a ticket to explain all the command in a separate chapter on the website: phel-lang/phel-lang.org#34
Adam Stokes
@adamstokes:matrix.org
[m]
So I got something working https://github.com/adam-stokes/phel-framework-x, the one thing im trying to figure out is when i do phel compile it'll compile the phel language into dist but my custom code doesn't seem to be written into dist
2 replies
Im loving being able to use the huge php ecosystem with phel
Adam Stokes
@adamstokes:matrix.org
[m]
My goal is to have a website created using RoadRunner application server, framework-x.org (which uses reactphp underneath)
If using an application server like RoadRunner that doesn't spin up php on every request could I get similar performance with https://github.com/adam-stokes/phel-framework-x/blob/main/public/index.php#L14-L16?
Adam Stokes
@adamstokes:matrix.org
[m]
ah phel compile is running the server
So this line https://github.com/adam-stokes/phel-framework-x/blob/main/src/boot.phel#L9 is being executed by phel compile, is there a recommended way to get around this?
Jens Haase
@jenshaase:matrix.org
[m]
Use the *compile-mode* variable as a condition: https://phel-lang.org/documentation/api/#compile-mode
Adam Stokes
@adamstokes:matrix.org
[m]
diff --git a/src/boot.phel b/src/boot.phel
index 529c0c5..32facf4 100644
--- a/src/boot.phel
+++ b/src/boot.phel
@@ -6,4 +6,5 @@

 (php/-> site-app (get "/" (fn [] (php/:: Response (plaintext "Hello There")))))

-(php/-> site-app (run))
\ No newline at end of file
+(when-not *compile-mode*
+    (php/-> site-app (run)))
Works great!
Adam Stokes
@adamstokes:matrix.org
[m]
@mabasic: Maybe you know, I was looking at RoadRunner as my app server, do you think I need to compile still?
7 replies
Yep that's the same php file im using :)
This is what im currently working on https://github.com/adam-stokes/phel-framework-x
2 replies
Adam Stokes
@adamstokes:matrix.org
[m]
So far it's going great
good call on that, i had 8955 __phel tmp files
Adam Stokes
@adamstokes:matrix.org
[m]
I really like this approach, I can be productive and then start bringing in more of the functional aspects of the language
Adam Stokes
@adamstokes:matrix.org
[m]
In some of the php docs i've come across use in closures, return new React\Promise\Promise(function ($resolve, $reject) use ($body) how would I represent that in phel?
Jens Haase
@jenshaase:matrix.org
[m]
use is not required in phel. You can just use fn and reference variables outside of the scope of the function.
Adam Stokes
@adamstokes:matrix.org
[m]
Probably a stupid question and my ignorance of functional programming, but for things like creating a controller https://symfony.com/doc/current/controller.html#a-basic-controller, since there is no class creation in phel is this possible still?
Adam Stokes
@adamstokes:matrix.org
[m]
hmm symphony uses type-hints too for declaring services to be injected
Jens Haase
@jenshaase
You can not create real classes in Phel. However, structs are classes and you can add methods to them by using interfaces: https://phel-lang.org/documentation/interfaces/
The struct my-type-with-two-interfaces is a PHP class that implements the interfaces MyFirstInterface and MySecondInterface.
Adam Stokes
@adamstokes:matrix.org
[m]
Ah ok, I did read about that in your docs, I'll give that a go
Jens Haase
@jenshaase
If you want to use Symfony in your project you probably use the router with functions instead of the controller.
Adam Stokes
@adamstokes:matrix.org
[m]
Thanks, I'm slowly training my brain to think that way
Jose Maria Valera Reales
@Chemaclass
Phel got 250 :star2: in GitHub! https://github.com/phel-lang/phel-lang/stargazers
Jens Haase
@jenshaase
Hey everybody, I just publish a new repository in the phel-lang organization. This repository contains a router library. It is still work in progress and requires some changes of Phel that have not been released yet but are already in master. Feel free to check it out: https://github.com/phel-lang/router
1 reply
Mochammad Farid Wajdi
@mfaridw
Hello, I just tried to run repl in powershell but got an error message instead.
stripos(): Argument #1 ($haystack) must be of type string, null given
#0 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Domain\Repl\ReplCommandSystemIo.php(71): stripos(NULL, 'editline')     
#1 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Command\ReplCommand.php(127): Phel\Run\Domain\Repl\ReplCommandSystemIo->isBracketedPasteSupported()
#2 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Command\ReplCommand.php(110): Phel\Run\Command\ReplCommand->addLineFromPromptToBuffer()
#3 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Command\ReplCommand.php(101): Phel\Run\Command\ReplCommand->loopReadLineAndAnalyze()
#4 D:\farid\phel\hello-world\vendor\symfony\console\Command\Command.php(298): Phel\Run\Command\ReplCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 D:\farid\phel\hello-world\vendor\symfony\console\Application.php(1015): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 D:\farid\phel\hello-world\vendor\symfony\console\Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Phel\Run\Command\ReplCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))        
#7 D:\farid\phel\hello-world\vendor\symfony\console\Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\phel(42): Symfony\Component\Console\Application->run()
#9 D:\farid\phel\hello-world\vendor\bin\phel(117): include('D:\\farid\\phel\\h...')
#10 {main}
4 replies
Jens Haase
@jenshaase
We just released version 0.7.0 of Phel. This release comes with a lot a small improvements to the core library. Read the blog post for more information: https://phel-lang.org/blog/release-0-7/
3 replies
Jesus Valera Reales
@JesusValera
image.png
Jens Haase
@jenshaase
I think I forgot to update the phel version in the composer.json of the website. I can fix this later.
Jose Maria Valera Reales
@Chemaclass
I created some good first issues for Phel, in case you are looking for a testing challenge/opportunity in a new project, like a testing kata. They are about adding unit tests for some SpecialForm that I did miss a year ago when I was working on them, and I learned a lot by doing this. I found this now, so instead of doing them myself, I think it's good to let others try themselves if someone wants to contribute doing anything but they don't know where to start. These are like "exclusives testing katas" with a lot of learning opportunities :)
Jens Haase
@jenshaase
👍